update merged, add .env file to resolve this
continuous-integration/drone/push Build is failing Details

merging_APE
Antoine PEREDERII 1 year ago
parent 9eb7074df5
commit 1b18825afa

@ -141,7 +141,7 @@ class AuthController extends BaseController
} }
#[Route(path: '/logout', name: 'logout', methods: ['POST'])] #[Route(path: '/logout', name: 'logout', methods: ['GET'])]
public function logout(IRequest $request): IResponse public function logout(IRequest $request): IResponse
{ {
$error = []; $error = [];

@ -1,423 +1,424 @@
<?php <?php
//
namespace App\Controller; //namespace App\Controller;
//
use App\Container; //use App\Container;
use App\Router\Request\IRequest; //use App\Router\Request\IRequest;
use App\Router\Response\Response; //use App\Router\Response\Response;
use Shared\Attributes\Route; //use Shared\Attributes\Route;
use Twig\Environment; //use Twig\Environment;
use Data\Core\Preferences; //use Data\Core\Preferences;
use Shared\Log; //use Shared\Log;
//
// TODO : Remove this BaseClass //// TODO : Remove this BaseClass
class Controller extends BaseController //class Controller extends BaseController
{ //{
//
#[Route(path: '/activity', name: 'activity', methods: ['GET'])] // #[Route(path: '/activity', name: 'activity', methods: ['GET'])]
public function activity(): Response // public function activity(): Response
{ // {
return $this->render('./page/activity.html.twig',[ // return $this->render('./page/activity.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [] // 'member' => []
]); // ]);
} // }
//
//
#[Route(path: '/exercices', name: 'exercices', methods: ['POST'])] // 8 // #[Route(path: '/exercices', name: 'exercices', methods: ['POST'])] // 8
public function exercices(String $type, String $intensite, String $date, IRequest $req): Response // public function exercices(String $type, String $intensite, String $date, IRequest $req): Response
{ // {
$exercicesArray = [ // $exercicesArray = [
[ // [
'date' => $date, // 'date' => $date,
'type' => $type, // 'type' => $type,
'intensite' => $intensite, // 'intensite' => $intensite,
'status' => 'A venur', // 'status' => 'A venur',
] // ]
]; // ];
return $this->render('./page/exercice.html.twig',[ // return $this->render('./page/exercice.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => $exercicesArray, // 'exos' => $exercicesArray,
'member' => [] // 'member' => []
]); // ]);
} // }
//
#[Route(path: '/search-user', name: 'search-user', methods: ['GET'])] // #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])]
public function searchUser(string $username, IRequest $req): Response // public function searchUser(string $username, IRequest $req): Response
{ // {
$taberror = []; // $taberror = [];
// FILTER // // FILTER
$utiliArray = [ // $utiliArray = [
[ // [
'nom' => 'John', // 'nom' => 'John',
'prenom' => 'Doe', // 'prenom' => 'Doe',
'img' => 'john_doe', // 'img' => 'john_doe',
'username' => 'johndoe', // 'username' => 'johndoe',
], // ],
[ // [
'nom' => 'Alice', // 'nom' => 'Alice',
'prenom' => 'Smith', // 'prenom' => 'Smith',
'img' => 'alice_smith', // 'img' => 'alice_smith',
'username' => 'alicesmith', // 'username' => 'alicesmith',
], // ],
]; // ];
// if(!Validation::val_string($name)){ // // if(!Validation::val_string($name)){
try { // try {
//code... // //code...
// $model->userMgr->addFriend($name); // // $model->userMgr->addFriend($name);
return $this->render('./page/addfriend.html.twig',[ // return $this->render('./page/addfriend.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => $utiliArray, // 'users' => $utiliArray,
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [], // 'member' => [],
'responce' => "Notification d'ajout envoyée à $username" // 'responce' => "Notification d'ajout envoyée à $username"
]); // ]);
} catch (\Throwable $th) { // } catch (\Throwable $th) {
//throw $th; // //throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]); // // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
} // }
// } // // }
//
} // }
//
#[Route(path: '/search-member', name: 'search-member', methods: ['GET'])] // #[Route(path: '/search-member', name: 'search-member', methods: ['GET'])]
public function searchMember(string $username, IRequest $req): Response // public function searchMember(string $username, IRequest $req): Response
{ // {
$taberror = []; // $taberror = [];
// FILTER // // FILTER
$utiliArray = [ // $utiliArray = [
[ // [
'nom' => 'John', // 'nom' => 'John',
'prenom' => 'Doe', // 'prenom' => 'Doe',
'img' => 'john_doe', // 'img' => 'john_doe',
'username' => 'johndoe', // 'username' => 'johndoe',
], // ],
[ // [
'nom' => 'Alice', // 'nom' => 'Alice',
'prenom' => 'Smith', // 'prenom' => 'Smith',
'img' => 'alice_smith', // 'img' => 'alice_smith',
'username' => 'alicesmith', // 'username' => 'alicesmith',
], // ],
]; // ];
// if(!Validation::val_string($name)){ // // if(!Validation::val_string($name)){
try { // try {
//code... // //code...
// $model->userMgr->addFriend($name); // // $model->userMgr->addFriend($name);
return $this->render('./page/addmember.html.twig',[ // return $this->render('./page/addmember.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => $utiliArray, // 'users' => $utiliArray,
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [], // 'member' => [],
'responce' => "Notification d'ajout envoyée à $username" // 'responce' => "Notification d'ajout envoyée à $username"
]); // ]);
} catch (\Throwable $th) { // } catch (\Throwable $th) {
//throw $th; // //throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]); // // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
} // }
// } // // }
//
} // }
//
#[Route(path: '/add-member', name: 'add-member', methods: ['POST'])] // #[Route(path: '/add-member', name: 'add-member', methods: ['POST'])]
public function addmember(string $username, IRequest $req): Response // public function addmember(string $username, IRequest $req): Response
{ // {
$taberror = []; // $taberror = [];
$utiliArray = [ // $utiliArray = [
[ // [
'nom' => 'John', // 'nom' => 'John',
'prenom' => 'Doe', // 'prenom' => 'Doe',
'img' => 'john_doe', // 'img' => 'john_doe',
'username' => 'johndoe', // 'username' => 'johndoe',
], // ],
[ // [
'nom' => 'Alice', // 'nom' => 'Alice',
'prenom' => 'Smith', // 'prenom' => 'Smith',
'img' => 'alice_smith', // 'img' => 'alice_smith',
'username' => 'alicesmith', // 'username' => 'alicesmith',
], // ],
]; // ];
// if(!Validation::val_string($name)){ // // if(!Validation::val_string($name)){
try { // try {
//code... // //code...
// $model->userMgr->addFriend($name); // // $model->userMgr->addFriend($name);
return $this->render('./page/addmember.html.twig',[ // return $this->render('./page/addmember.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => $utiliArray, // 'users' => $utiliArray,
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [], // 'member' => [],
'responce' => "Notification d'ajout envoyée à $username" // 'responce' => "Notification d'ajout envoyée à $username"
]); // ]);
} catch (\Throwable $th) { // } catch (\Throwable $th) {
//throw $th; // //throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]); // // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
} // }
// } // // }
//
} // }
//
#[Route(path: '/member', name: 'member', methods: ['GET'])] // #[Route(path: '/member', name: 'member', methods: ['GET'])]
public function member(): Response // public function member(): Response
{ // {
$utiliArray = [ // $utiliArray = [
[ // [
'nom' => 'John', // 'nom' => 'John',
'prenom' => 'Doe', // 'prenom' => 'Doe',
'img' => 'john_doe', // 'img' => 'john_doe',
'username' => 'johndoe', // 'username' => 'johndoe',
], // ],
[ // [
'nom' => 'Alice', // 'nom' => 'Alice',
'prenom' => 'Smith', // 'prenom' => 'Smith',
'img' => 'alice_smith', // 'img' => 'alice_smith',
'username' => 'alicesmith', // 'username' => 'alicesmith',
], // ],
]; // ];
return $this->render('./page/addmember.html.twig',[ // return $this->render('./page/addmember.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => $utiliArray, // 'users' => $utiliArray,
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [], // 'member' => [],
]); // ]);
} // }
//
//
#[Route(path: '/friendlist', name: 'friendlist', methods: ['POST'])] // #[Route(path: '/friendlist', name: 'friendlist', methods: ['POST'])]
public function friendlist(string $username, IRequest $req): Response // public function friendlist(string $username, IRequest $req): Response
{ // {
$utiliArray = [ // $utiliArray = [
[ // [
'nom' => 'John', // 'nom' => 'John',
'prenom' => 'Doe', // 'prenom' => 'Doe',
'img' => 'john_doe', // 'img' => 'john_doe',
'username' => 'johndoe', // 'username' => 'johndoe',
], // ],
[ // [
'nom' => 'Alice', // 'nom' => 'Alice',
'prenom' => 'Smith', // 'prenom' => 'Smith',
'img' => 'alice_smith', // 'img' => 'alice_smith',
'username' => 'alicesmith', // 'username' => 'alicesmith',
], // ],
]; // ];
/* TODO */ // /* TODO */
//
// -> Enlever ou bloquer un utilisateur en fonction de son username // // -> Enlever ou bloquer un utilisateur en fonction de son username
//
return $this->render('./page/friend.html.twig',[ // return $this->render('./page/friend.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => $utiliArray, // 'friendship' => $utiliArray,
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [], // 'member' => [],
]); // ]);
} // }
//
#[Route(path: '/friendlist', name: 'friendlist2', methods: ['GET'])] // #[Route(path: '/friendlist', name: 'friendlist2', methods: ['GET'])]
public function friendlist2(): Response // public function friendlist2(): Response
{ // {
$utiliArray = [ // $utiliArray = [
[ // [
'nom' => 'John', // 'nom' => 'John',
'prenom' => 'Doe', // 'prenom' => 'Doe',
'img' => 'test', // 'img' => 'test',
'status' => 'johndoe', // 'status' => 'johndoe',
'username' => 'jdoe', // 'username' => 'jdoe',
], // ],
[ // [
'nom' => 'Alice', // 'nom' => 'Alice',
'prenom' => 'Smith', // 'prenom' => 'Smith',
'img' => 'test2', // 'img' => 'test2',
'status' => 'alicesmith', // 'status' => 'alicesmith',
'username' => 'asmith', // 'username' => 'asmith',
], // ],
]; // ];
return $this->render('./page/friend.html.twig',[ // return $this->render('./page/friend.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => $utiliArray, // 'friendship' => $utiliArray,
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [], // 'member' => [],
]); // ]);
} // }
//
#[Route(path: '/coaching', name: 'coaching', methods: ['GET'])] // #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])]
public function coaching(): Response // public function coaching(): Response
{ // {
return $this->render('./page/coaching.html.twig',[ // return $this->render('./page/coaching.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [] // 'member' => []
]); // ]);
} // }
//
#[Route(path: '/mail', name: 'mail', methods: ['GET'])] // #[Route(path: '/mail', name: 'mail', methods: ['GET'])]
public function mail(): Response // public function mail(): Response
{ // {
return $this->render('./page/mail.html.twig',[ // return $this->render('./page/mail.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [] // 'member' => []
]); // ]);
} // }
//
//
#[Route(path: '/profile', name: 'profile', methods: ['GET'])] // #[Route(path: '/profile', name: 'profile', methods: ['GET'])]
public function profile(): Response // public function profile(): Response
{ // {
return $this->render('./page/profile.html.twig',[ // return $this->render('./page/profile.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [] // 'member' => []
]); // ]);
} // }
//
//
#[Route(path: '/psettings', name: 'psettings', methods: ['POST'])] // #[Route(path: '/psettings', name: 'psettings', methods: ['POST'])]
public function psettings(string $nom,string $prenom,string $dateNaissance,string $mail,string $tel, IRequest $req): Response // public function psettings(string $nom,string $prenom,string $dateNaissance,string $mail,string $tel, IRequest $req): Response
{ // {
//
//
return $this->render('./page/settings.html.twig',[ // return $this->render('./page/settings.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => $prenom, // 'user' => $prenom,
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [] // 'member' => []
]); // ]);
} // }
//
//
//
//
#[Route(path: '/pass', name: 'pass', methods: ['GET'])] // #[Route(path: '/pass', name: 'pass', methods: ['GET'])]
public function pass(): Response // public function pass(): Response
{ // {
//
// CONFIRMER LES DONNESS !!!!! IMPORTANT // // CONFIRMER LES DONNESS !!!!! IMPORTANT
//
return $this->render('./page/password.html.twig',[ // return $this->render('./page/password.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [] // 'member' => []
]); // ]);
} // }
//
#[Route(path: '/password', name: 'password', methods: ['POST'])] // #[Route(path: '/password', name: 'password', methods: ['POST'])]
public function password(string $email, IRequest $req): Response // public function password(string $email, IRequest $req): Response
{ // {
//
// CONFIRMER LES DONNESS !!!!! IMPORTANT // // CONFIRMER LES DONNESS !!!!! IMPORTANT
//
return $this->render('./page/login.html.twig',[ // return $this->render('./page/login.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [] // 'member' => []
]); // ]);
} // }
//
} //}
//
//
//

@ -87,25 +87,25 @@ class UserController extends BaseController
]); ]);
} }
#[Route(path: '/logout', name: 'logout', methods: ['GET'])] // #[Route(path: '/logout', name: 'logout', methods: ['GET'])]
public function logout(IRequest $request): IResponse // public function logout(IRequest $request): IResponse
{ // {
$error = []; // $error = [];
//
try { // try {
//
if($this->userMgr->deconnecter()){ // if($this->userMgr->deconnecter()){
return new RedirectResponse('/'); // return new RedirectResponse('/');
} // }
else{ // else{
$error [] = "Erreur de deconnexion. Essayez encore"; // $error [] = "Erreur de deconnexion. Essayez encore";
return new RedirectResponse('/'); // return new RedirectResponse('/');
} // }
//
} catch (\Throwable $th) { // } catch (\Throwable $th) {
$error [] =$th->getMessage(); // $error [] =$th->getMessage();
return new RedirectResponse('/'); // return new RedirectResponse('/');
} // }
} // }
} }
Loading…
Cancel
Save