From 3e6d4aed6f44ed16e591ac2477fafd7184881e6d Mon Sep 17 00:00:00 2001 From: MohamedDrine Date: Mon, 8 Mar 2021 17:50:28 +0100 Subject: [PATCH 1/6] aze --- .env | 2 +- app/Config/Filters.php | 1 + app/Config/Routes.php | 8 + app/Controllers/PublicationController.php | 149 ++++++ app/Controllers/Users.php | 3 + app/Filters/Auth.php | 2 +- app/Filters/AuthAdm.php | 24 + app/Models/PublicationModel.php | 41 ++ app/Views/aprouvepublish.php | 37 ++ app/Views/displayPublication.php | 33 ++ app/Views/publication.php | 44 ++ app/Views/register.php | 16 +- app/Views/templates/header.php | 26 +- .../.github/workflows/push.yml | 250 --------- vendor/phpunit/phpunit/.psalm/baseline.xml | 468 ---------------- vendor/phpunit/phpunit/.psalm/config.xml | 55 -- .../phpunit/.psalm/static-analysis.xml | 51 -- .../inspectionProfiles/Project_Default.xml | 499 ------------------ vendor/sebastian/type/.idea/misc.xml | 6 - vendor/sebastian/type/.idea/modules.xml | 8 - .../.idea/php-inspections-ea-ultimate.xml | 20 - vendor/sebastian/type/.idea/php.xml | 42 -- vendor/sebastian/type/.idea/type.iml | 40 -- vendor/sebastian/type/.idea/vcs.xml | 6 - ...ci_session2oejikks3rvu3ir9timrqstt0c5tkmng | 1 - ...ci_session3ft4oll5d2oovvb95t7l0ojchqk6j7dm | 1 - ...ci_session3q42efc710cb48rvhm59ivoshljr44jm | 1 - ...ci_session3q9ibksvdkuaorasppbnq3auov9blom7 | 1 - ...ci_session4pmk9a1sh0n8mmmskja9s4d71ibq8r35 | 1 - ...ci_session6gr05j2r5su15c9c5ba32r5adbvae2il | 1 - ...ci_session765uf5u7vt0fjovu1ivpibfpinu027rp | 1 - ...ci_sessionees8blr9n3gmf0g2ne4ijo8ck4eev77a | 1 - ...ci_sessionq2viigq8a1o011p71lmmdo46a8ji5f1u | 1 - ...ci_sessionqnm2ui915olfunn36mt0v0kj7beid14n | 1 - ...ci_sessionsgafjkjtkad01g5nvemcap4h6k7qt3bq | 1 - 35 files changed, 370 insertions(+), 1472 deletions(-) create mode 100644 app/Controllers/PublicationController.php create mode 100644 app/Filters/AuthAdm.php create mode 100644 app/Models/PublicationModel.php create mode 100644 app/Views/aprouvepublish.php create mode 100644 app/Views/displayPublication.php create mode 100644 app/Views/publication.php delete mode 100644 vendor/phpdocumentor/reflection-docblock/.github/workflows/push.yml delete mode 100644 vendor/phpunit/phpunit/.psalm/baseline.xml delete mode 100644 vendor/phpunit/phpunit/.psalm/config.xml delete mode 100644 vendor/phpunit/phpunit/.psalm/static-analysis.xml delete mode 100644 vendor/sebastian/type/.idea/inspectionProfiles/Project_Default.xml delete mode 100644 vendor/sebastian/type/.idea/misc.xml delete mode 100644 vendor/sebastian/type/.idea/modules.xml delete mode 100644 vendor/sebastian/type/.idea/php-inspections-ea-ultimate.xml delete mode 100644 vendor/sebastian/type/.idea/php.xml delete mode 100644 vendor/sebastian/type/.idea/type.iml delete mode 100644 vendor/sebastian/type/.idea/vcs.xml delete mode 100644 writable/session/ci_session2oejikks3rvu3ir9timrqstt0c5tkmng delete mode 100644 writable/session/ci_session3ft4oll5d2oovvb95t7l0ojchqk6j7dm delete mode 100644 writable/session/ci_session3q42efc710cb48rvhm59ivoshljr44jm delete mode 100644 writable/session/ci_session3q9ibksvdkuaorasppbnq3auov9blom7 delete mode 100644 writable/session/ci_session4pmk9a1sh0n8mmmskja9s4d71ibq8r35 delete mode 100644 writable/session/ci_session6gr05j2r5su15c9c5ba32r5adbvae2il delete mode 100644 writable/session/ci_session765uf5u7vt0fjovu1ivpibfpinu027rp delete mode 100644 writable/session/ci_sessionees8blr9n3gmf0g2ne4ijo8ck4eev77a delete mode 100644 writable/session/ci_sessionq2viigq8a1o011p71lmmdo46a8ji5f1u delete mode 100644 writable/session/ci_sessionqnm2ui915olfunn36mt0v0kj7beid14n delete mode 100644 writable/session/ci_sessionsgafjkjtkad01g5nvemcap4h6k7qt3bq diff --git a/.env b/.env index fb160023..40725214 100644 --- a/.env +++ b/.env @@ -50,7 +50,7 @@ CI_ENVIRONMENT = development #-------------------------------------------------------------------- database.default.hostname = localhost -database.default.database = test6 +database.default.database = login database.default.username = root database.default.password = database.default.DBDriver = MySQLi diff --git a/app/Config/Filters.php b/app/Config/Filters.php index 26804a36..d8f90506 100644 --- a/app/Config/Filters.php +++ b/app/Config/Filters.php @@ -10,6 +10,7 @@ class Filters extends BaseConfig 'csrf' => \CodeIgniter\Filters\CSRF::class, 'toolbar' => \CodeIgniter\Filters\DebugToolbar::class, 'honeypot' => \CodeIgniter\Filters\Honeypot::class, + 'authadmin' => \App\Filters\AuthAdm::class, 'auth' => \App\Filters\Auth::class, 'noauth' => \App\Filters\Noauth::class, 'userscheck' => \App\Filters\UsersCheck::class, diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 37c81403..9dc60173 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -34,7 +34,15 @@ $routes->get('logout', 'Users::logout'); $routes->match(['get','post'],'register', 'Users::register', ['filter' => 'noauth']); $routes->match(['get','post'],'profile', 'Users::profile',['filter' => 'auth']); +$routes->match(['get','post'],'publication', 'PublicationController::publication',['filter' => 'auth']); +$routes->match(['get','post'],'displayPublication', 'PublicationController::displayVerifiedPublication',['filter' => 'auth']); $routes->get('dashboard', 'Dashboard::index',['filter' => 'auth']); +$routes->match(['get','post'],'userpublication', 'PublicationController::userPublish',['filter' => 'auth']); +$routes->match(['get','post'],'unverifiedpublication', 'PublicationController::displayUnVerifiedPublication',['filter' => 'authadmin']); +$routes->match(['get','post'],'publicationGestion', 'PublicationController::publicationGestion',['filter' => 'authadmin']); +$routes->match(['get','post'],'aprouvePublish', 'PublicationController::aprouvePublish',['filter' => 'authadmin']); +$routes->match(['get','post'],'deletePublish', 'PublicationController::deletePublish',['filter' => 'authadmin']); + /** * -------------------------------------------------------------------- diff --git a/app/Controllers/PublicationController.php b/app/Controllers/PublicationController.php new file mode 100644 index 00000000..974082e3 --- /dev/null +++ b/app/Controllers/PublicationController.php @@ -0,0 +1,149 @@ +request->getMethod() == 'post') { + //let's do the validation here + $rules = [ + 'hashtag' => 'required|min_length[1]|max_length[255]', + 'description' => 'required|min_length[1]|max_length[255]', + 'auteur' => 'required|min_length[1]|max_length[255]' + + ]; + + if (! $this->validate($rules)) { + $data['validation'] = $this->validator; + }else{ + $model = new PublicationModel(); + + $newData = [ + 'users_id' => session()->get('id'), + 'hashtag' => $this->request->getVar('hashtag'), + 'description' => $this->request->getVar('description'), + 'auteur' => $this->request->getVar('auteur') + + + ]; + $model->save($newData); + $session = session(); + $session->setFlashdata('success', 'Successful Publish'); + return redirect()->to('/'); + + } + } + + + echo view('templates/header', $data); + echo view('publication'); + echo view('templates/footer'); + } + + public function displayVerifiedPublication(){ + + $model = new PublicationModel(); + $dataTable['table'] = $model->selectVerifiedPublish(); + + + + echo view('templates/header'); + echo view('displayPublication', $dataTable); + echo view('templates/footer'); + } + + public function displayUnVerifiedPublication(){ + + $model = new PublicationModel(); + $dataTable['table'] = $model->selectUnVerifiedPublish(); + + + + echo view('templates/header'); + echo view('aprouvepublish', $dataTable); + echo view('templates/footer'); + } + + public function userPublish(){ + $idUser = session()->get('id'); + $model = new PublicationModel(); + $dataTable['table'] = $model->selectUserPublish($idUser); + + echo view('templates/header'); + echo view('displayPublication', $dataTable); + echo view('templates/footer'); + } + +public function publicationGestion(){ + if(isset($_POST['approuve'])) { + $this->aprouvePublish(); + } + if(isset($_POST['delete'])){ + $this->deletePublish(); + + } + + $this->displayUnVerifiedPublication(); + +} + + public function aprouvePublish(){ + if(isset($_POST['approuve'])) { + + + $data = []; + helper(['form']); + + if ($this->request->getMethod() == 'post') { + //let's do the validation here + + + $newData = [ + 'isverified' => 1, + + + ]; + $model = new PublicationModel(); + $model->update($this->request->getVar('approuve'), $newData); + $session = session(); + $session->setFlashdata('success', 'Successful Publish'); + return redirect()->to('/'); + + + } + + + } + + } + public function deletePublish(){ + $data = []; + helper(['form']); + + if ($this->request->getMethod() == 'post') { + + $model = new PublicationModel(); + $model->delete(['id' => $this->request->getVar('delete')]); + $session = session(); + $session->setFlashdata('success', 'Successful deleted'); + return redirect()->to('/'); + + + } + + + + } + + +} \ No newline at end of file diff --git a/app/Controllers/Users.php b/app/Controllers/Users.php index 1b77a582..a87ad2b7 100644 --- a/app/Controllers/Users.php +++ b/app/Controllers/Users.php @@ -50,6 +50,7 @@ private function setUserSession($user){ 'firstname' => $user['firstname'], 'lastname' => $user['lastname'], 'email' => $user['email'], + 'droits' => $user['droits'], 'isLoggedIn' => true, ]; @@ -96,6 +97,8 @@ public function register(){ echo view('templates/footer'); } + + public function profile(){ $data = []; diff --git a/app/Filters/Auth.php b/app/Filters/Auth.php index 51a4ffd3..415a7866 100644 --- a/app/Filters/Auth.php +++ b/app/Filters/Auth.php @@ -9,7 +9,7 @@ class Auth implements FilterInterface public function before(RequestInterface $request) { // Do something here - if(! session()->get('isLoggedIn')){ + if(!session()->get('isLoggedIn')){ return redirect()->to('/'); } diff --git a/app/Filters/AuthAdm.php b/app/Filters/AuthAdm.php new file mode 100644 index 00000000..12782be9 --- /dev/null +++ b/app/Filters/AuthAdm.php @@ -0,0 +1,24 @@ +get('droits') < 2 ){ + return redirect()->to('/'); + } + + } + + //-------------------------------------------------------------------- + + public function after(RequestInterface $request, ResponseInterface $response) + { + // Do something here + } +} diff --git a/app/Models/PublicationModel.php b/app/Models/PublicationModel.php new file mode 100644 index 00000000..7725f114 --- /dev/null +++ b/app/Models/PublicationModel.php @@ -0,0 +1,41 @@ +db->table('publication'); + $builder = $builder->where('users_id', $idUser); + $data = $builder->get()->getResultArray(); + + return $data; + + } + + function selectVerifiedPublish(){ + $builder = $this->db->table('publication'); + $builder = $builder->where('isverified', 1); + $data = $builder->get()->getResultArray(); + + return $data; + + } + + function selectUnVerifiedPublish(){ + $builder = $this->db->table('publication'); + $builder = $builder->where('isverified', 0); + $data = $builder->get()->getResultArray(); + + return $data; + + } + +} diff --git a/app/Views/aprouvepublish.php b/app/Views/aprouvepublish.php new file mode 100644 index 00000000..fd835581 --- /dev/null +++ b/app/Views/aprouvepublish.php @@ -0,0 +1,37 @@ + + + + + + +
+

Ressources

+ + + + + + + + + + + + + + + + + + + + + + + + + +
hashtagauteurdescription
+
+ + \ No newline at end of file diff --git a/app/Views/displayPublication.php b/app/Views/displayPublication.php new file mode 100644 index 00000000..49040f0e --- /dev/null +++ b/app/Views/displayPublication.php @@ -0,0 +1,33 @@ + + + + + + +
+

Ressources

+ + + + + + + + + + + + + + + + + + + + + +
hashtagauteurdescription
+
+ + \ No newline at end of file diff --git a/app/Views/publication.php b/app/Views/publication.php new file mode 100644 index 00000000..7a86c120 --- /dev/null +++ b/app/Views/publication.php @@ -0,0 +1,44 @@ +
+
+
+
+

Publication

+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ + + +
+ +
+
+ +
+
+ Annuler +
+
+
+
+
+
+
diff --git a/app/Views/register.php b/app/Views/register.php index 5fb945ad..4e17391b 100644 --- a/app/Views/register.php +++ b/app/Views/register.php @@ -2,37 +2,37 @@
-

Register

+

Créer un compte


- +
- +
- +
- +
- +
@@ -47,10 +47,10 @@
- +
diff --git a/app/Views/templates/header.php b/app/Views/templates/header.php index 7ef204a4..f05a7452 100644 --- a/app/Views/templates/header.php +++ b/app/Views/templates/header.php @@ -13,7 +13,7 @@ ?>
From 1636781059be40af441170d768b65eacbd30af6e Mon Sep 17 00:00:00 2001 From: MohamedDrine Date: Mon, 8 Mar 2021 19:18:05 +0100 Subject: [PATCH 4/6] Update login.php --- app/Views/login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Views/login.php b/app/Views/login.php index d6ae2ce7..10002bfb 100644 --- a/app/Views/login.php +++ b/app/Views/login.php @@ -30,7 +30,7 @@
From 6976c09e760144e1e7eedbbeca2831d3267e0f94 Mon Sep 17 00:00:00 2001 From: MohamedDrine Date: Mon, 8 Mar 2021 20:58:03 +0100 Subject: [PATCH 5/6] Commentaires --- .idea/.gitignore | 8 + .idea/codeigniter4login.iml | 48 ++++ .idea/modules.xml | 8 + .idea/php.xml | 51 ++++ .idea/phpunit.xml | 10 + .idea/vcs.xml | 6 + app/Controllers/BaseController.php | 2 +- app/Controllers/Dashboard.php | 2 +- app/Controllers/Home.php | 12 - app/Controllers/PublicationController.php | 93 +++---- app/Controllers/Users.php | 16 +- app/Filters/Auth.php | 2 +- app/Filters/AuthAdm.php | 2 +- app/Filters/Noauth.php | 2 +- app/Filters/UsersCheck.php | 2 +- app/Models/UserModel.php | 2 +- app/Views/welcome_message.php | 324 ---------------------- 17 files changed, 192 insertions(+), 398 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/codeigniter4login.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/php.xml create mode 100644 .idea/phpunit.xml create mode 100644 .idea/vcs.xml delete mode 100644 app/Controllers/Home.php delete mode 100644 app/Views/welcome_message.php diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..253dffe1 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/../../../../../:\xampp\htdocs\codeigniter4login\.idea/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/codeigniter4login.iml b/.idea/codeigniter4login.iml new file mode 100644 index 00000000..646e0a9d --- /dev/null +++ b/.idea/codeigniter4login.iml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..c6562bb3 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 00000000..afa58c64 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/phpunit.xml b/.idea/phpunit.xml new file mode 100644 index 00000000..4f8104cf --- /dev/null +++ b/.idea/phpunit.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 252692f0..fb584c32 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -13,7 +13,7 @@ * * @package CodeIgniter */ - +/* Controlleur de base de CI*/ use CodeIgniter\Controller; class BaseController extends Controller diff --git a/app/Controllers/Dashboard.php b/app/Controllers/Dashboard.php index b83e8f45..86704d43 100644 --- a/app/Controllers/Dashboard.php +++ b/app/Controllers/Dashboard.php @@ -1,5 +1,5 @@ request->getMethod() == 'post') { + if ($this->request->getMethod() == 'post') { /* méthode post pour masqué les infos */ //let's do the validation here $rules = [ - 'hashtag' => 'required|min_length[1]|max_length[255]', + 'hashtag' => 'required|min_length[1]|max_length[255]', /* règle de longueur des info */ 'description' => 'required|min_length[1]|max_length[255]', 'auteur' => 'required|min_length[1]|max_length[255]' ]; - if (! $this->validate($rules)) { - $data['validation'] = $this->validator; + if (! $this->validate($rules)) { /* est_ce que regle NOK ?*/ + $data['validation'] = $this->validator; /*NOK*/ }else{ - $model = new PublicationModel(); + $model = new PublicationModel(); /* Création d'un nouvel objet PublicationModel afin d'appeler notre model*/ $newData = [ - 'users_id' => session()->get('id'), - 'hashtag' => $this->request->getVar('hashtag'), + 'users_id' => session()->get('id'), /*Récuperation de l'id de l'user connecté que l'on affectera à la publication afin de lié user et publi */ + 'hashtag' => $this->request->getVar('hashtag'), /* Récupération des var de POST*/ 'description' => $this->request->getVar('description'), 'auteur' => $this->request->getVar('auteur') ]; - $model->save($newData); + $model->save($newData); /* save est une méthode de CI pour sauvegarder des data en db équivaut à INSERT INTO etc.....*/ $session = session(); - $session->setFlashdata('success', 'Successful Publish'); - return redirect()->to('/'); + $session->setFlashdata('success', 'Successful Publish'); /*Validation*/ + return redirect()->to('/'); /*Rédirection vers dashboard*/ } } - echo view('templates/header', $data); + echo view('templates/header', $data); /* Appel des vues*/ echo view('publication'); echo view('templates/footer'); } - public function displayVerifiedPublication(){ + public function displayVerifiedPublication(){ /*AFFICHAGE des publi verifiée*/ $model = new PublicationModel(); $dataTable['table'] = $model->selectVerifiedPublish(); @@ -62,7 +62,7 @@ public function displayVerifiedPublication(){ echo view('templates/footer'); } - public function displayUnVerifiedPublication(){ + public function displayUnVerifiedPublication(){ /*AFFICHAGE des publi non vérifiée*/ $model = new PublicationModel(); $dataTable['table'] = $model->selectUnVerifiedPublish(); @@ -74,66 +74,53 @@ public function displayUnVerifiedPublication(){ echo view('templates/footer'); } - public function userPublish(){ + public function userPublish(){ /*Afficher les publication de l'user courant */ $idUser = session()->get('id'); $model = new PublicationModel(); - $dataTable['table'] = $model->selectUserPublish($idUser); + $dataTable['table'] = $model->selectUserPublish($idUser); /*Envoi en parametre l'id de l'user courant au model */ echo view('templates/header'); echo view('displayPublication', $dataTable); echo view('templates/footer'); } -public function publicationGestion(){ - if(isset($_POST['approuve'])) { - $this->aprouvePublish(); - } - if(isset($_POST['delete'])){ - $this->deletePublish(); - - } - $this->displayUnVerifiedPublication(); -} + public function aprouvePublish() + { /*Permet d'approuvé les publications*/ - public function aprouvePublish(){ - if(isset($_POST['approuve'])) { + helper(['form']); + if ($this->request->getMethod() == 'post') { + // - $data = []; - helper(['form']); - if ($this->request->getMethod() == 'post') { - //let's do the validation here + $newData = [ // On change l'état du champs isverified à 1 + 'isverified' => 1, - $newData = [ - 'isverified' => 1, + ]; + $model = new PublicationModel(); + $model->update($this->request->getVar('approuve'), $newData); + $session = session(); + $session->setFlashdata('success', 'Publication approuvée !'); + return redirect()->to('/'); - ]; - $model = new PublicationModel(); - $model->update($this->request->getVar('approuve'), $newData); - $session = session(); - $session->setFlashdata('success', 'Successful Publish'); - return redirect()->to('/'); + } - } + } - } - - } - public function deletePublish(){ + public function deletePublish(){ //Pour supprimer une publication $data = []; helper(['form']); if ($this->request->getMethod() == 'post') { $model = new PublicationModel(); - $model->delete(['id' => $this->request->getVar('delete')]); + $model->delete(['id' => $this->request->getVar('delete')]); // supprimer une ligne dans la table Publication en fct de son id $session = session(); $session->setFlashdata('success', 'Successful deleted'); return redirect()->to('/'); @@ -144,6 +131,18 @@ public function deletePublish(){ } + public function publicationGestion(){ //gère l'aprobation ou la suppression des publication en fonction du bouton cliqué + if(isset($_POST['approuve'])) { + $this->aprouvePublish(); + } + if(isset($_POST['delete'])){ + $this->deletePublish(); + + } + + $this->displayUnVerifiedPublication(); + + } } \ No newline at end of file diff --git a/app/Controllers/Users.php b/app/Controllers/Users.php index a87ad2b7..c2d37904 100644 --- a/app/Controllers/Users.php +++ b/app/Controllers/Users.php @@ -3,7 +3,7 @@ use App\Models\UserModel; -class Users extends BaseController +class Users extends BaseController /*Déclaration de classe qui hérite du controlleur de base de CI*/ { public function index() { @@ -12,7 +12,7 @@ public function index() if ($this->request->getMethod() == 'post') { - //let's do the validation here + $rules = [ 'email' => 'required|min_length[6]|max_length[50]|valid_email', 'password' => 'required|min_length[8]|max_length[255]|validateUser[email,password]', @@ -20,7 +20,7 @@ public function index() $errors = [ 'password' => [ - 'validateUser' => 'Email or Password don\'t match' + 'validateUser' => 'Informations erronées ' ] ]; @@ -44,7 +44,7 @@ public function index() echo view('templates/footer'); } - private function setUserSession($user){ + private function setUserSession($user){ // u recupère les infos de l'user à la connexion $data = [ 'id' => $user['id'], 'firstname' => $user['firstname'], @@ -58,13 +58,13 @@ private function setUserSession($user){ return true; } - public function register(){ + public function register(){ //inscription $data = []; helper(['form']); if ($this->request->getMethod() == 'post') { //let's do the validation here - $rules = [ + $rules = [ //règles 'firstname' => 'required|min_length[3]|max_length[20]', 'lastname' => 'required|min_length[3]|max_length[20]', 'email' => 'required|min_length[6]|max_length[50]|valid_email|is_unique[users.email]', @@ -145,8 +145,8 @@ public function profile(){ } public function logout(){ - session()->destroy(); - return redirect()->to('/'); + session()->destroy(); // met fin à la session + return redirect()->to('/'); //redirection vers la racine } //-------------------------------------------------------------------- diff --git a/app/Filters/Auth.php b/app/Filters/Auth.php index 415a7866..ec3736b3 100644 --- a/app/Filters/Auth.php +++ b/app/Filters/Auth.php @@ -4,7 +4,7 @@ use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\Filters\FilterInterface; -class Auth implements FilterInterface +class Auth implements FilterInterface // filtre qui permet de rediriger un utilisateur qui n'est pas logger { public function before(RequestInterface $request) { diff --git a/app/Filters/AuthAdm.php b/app/Filters/AuthAdm.php index 12782be9..73f808f6 100644 --- a/app/Filters/AuthAdm.php +++ b/app/Filters/AuthAdm.php @@ -4,7 +4,7 @@ use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\Filters\FilterInterface; -class AuthAdm implements FilterInterface +class AuthAdm implements FilterInterface // filtre qui permet de rediriger un utilisateur qui n'a pas les droits { public function before(RequestInterface $request) { diff --git a/app/Filters/Noauth.php b/app/Filters/Noauth.php index 41ec060e..b0fa71cd 100644 --- a/app/Filters/Noauth.php +++ b/app/Filters/Noauth.php @@ -4,7 +4,7 @@ use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\Filters\FilterInterface; -class Noauth implements FilterInterface +class Noauth implements FilterInterface // filtre qui permet de rediriger un utilisateur qui est logger { public function before(RequestInterface $request) { diff --git a/app/Filters/UsersCheck.php b/app/Filters/UsersCheck.php index b460313b..c32304aa 100644 --- a/app/Filters/UsersCheck.php +++ b/app/Filters/UsersCheck.php @@ -4,7 +4,7 @@ use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\Filters\FilterInterface; -class UsersCheck implements FilterInterface +class UsersCheck implements FilterInterface // ?????????????????????????? { public function before(RequestInterface $request) { diff --git a/app/Models/UserModel.php b/app/Models/UserModel.php index 6923eb1f..f419fc78 100644 --- a/app/Models/UserModel.php +++ b/app/Models/UserModel.php @@ -26,7 +26,7 @@ protected function beforeUpdate(array $data){ protected function passwordHash(array $data){ if(isset($data['data']['password'])) - $data['data']['password'] = password_hash($data['data']['password'], PASSWORD_DEFAULT); + $data['data']['password'] = password_hash($data['data']['password'], PASSWORD_DEFAULT); // Cryptage Bcrypt du mdp return $data; } diff --git a/app/Views/welcome_message.php b/app/Views/welcome_message.php deleted file mode 100644 index f2a7389b..00000000 --- a/app/Views/welcome_message.php +++ /dev/null @@ -1,324 +0,0 @@ - - - - - Welcome to CodeIgniter 4! - - - - - - - - - - - -
- - - -
- -

Welcome to CodeIgniter

- -

The small framework with powerful features

- -
- -
- - - -
- -

About this page

- -

The page you are looking at is being generated dynamically by CodeIgniter.

- -

If you would like to edit this page you will find it located at:

- -
app/Views/welcome_message.php
- -

The corresponding controller for this page can be found at:

- -
app/Controllers/Home.php
- -
- -
- -
- -

Go further

- -

- - Learn -

- -

The User Guide contains an introduction, tutorial, a number of "how to" - guides, and then reference documentation for the components that make up - the framework. Check the User Guide !

- -

- - Discuss -

- -

CodeIgniter is a community-developed open source project, with several - venues for the community members to gather and exchange ideas. View all - the threads on CodeIgniter's forum, or chat on Slack !

- -

- - Contribute -

- -

CodeIgniter is a community driven project and accepts contributions - of code and documentation from the community. Why not - - join us ?

- -
- -
- - - -
-
- -

Page rendered in {elapsed_time} seconds

- -

Environment:

- -
- -
- -

© CodeIgniter Foundation. CodeIgniter is open source project released under the MIT - open source licence.

- -
- -
- - - - - - - - - From 167f6aaf153cc24b91a019b6c15577fe10fc199f Mon Sep 17 00:00:00 2001 From: MohamedDrine Date: Tue, 9 Mar 2021 19:12:40 +0100 Subject: [PATCH 6/6] Traduction --- app/Controllers/PublicationController.php | 1 - app/Controllers/Users.php | 10 +++++----- app/Views/dashboard.php | 2 +- app/Views/login.php | 8 ++++---- app/Views/profile.php | 12 ++++++------ 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/app/Controllers/PublicationController.php b/app/Controllers/PublicationController.php index 1d77bad9..79adeb40 100644 --- a/app/Controllers/PublicationController.php +++ b/app/Controllers/PublicationController.php @@ -15,7 +15,6 @@ public function publication(){ /*Crée une nouvelle publication*/ helper(['form']); if ($this->request->getMethod() == 'post') { /* méthode post pour masqué les infos */ - //let's do the validation here $rules = [ 'hashtag' => 'required|min_length[1]|max_length[255]', /* règle de longueur des info */ 'description' => 'required|min_length[1]|max_length[255]', diff --git a/app/Controllers/Users.php b/app/Controllers/Users.php index c2d37904..bd3fa41c 100644 --- a/app/Controllers/Users.php +++ b/app/Controllers/Users.php @@ -63,7 +63,7 @@ public function register(){ //inscription helper(['form']); if ($this->request->getMethod() == 'post') { - //let's do the validation here + $rules = [ //règles 'firstname' => 'required|min_length[3]|max_length[20]', 'lastname' => 'required|min_length[3]|max_length[20]', @@ -83,9 +83,9 @@ public function register(){ //inscription 'email' => $this->request->getVar('email'), 'password' => $this->request->getVar('password'), ]; - $model->save($newData); + $model->save($newData); // INSERT $session = session(); - $session->setFlashdata('success', 'Successful Registration'); + $session->setFlashdata('success', 'Inscription validée'); return redirect()->to('/'); } @@ -106,7 +106,7 @@ public function profile(){ $model = new UserModel(); if ($this->request->getMethod() == 'post') { - //let's do the validation here + $rules = [ 'firstname' => 'required|min_length[3]|max_length[20]', 'lastname' => 'required|min_length[3]|max_length[20]', @@ -132,7 +132,7 @@ public function profile(){ } $model->save($newData); - session()->setFlashdata('success', 'Successfuly Updated'); + session()->setFlashdata('success', 'Mise à jour réuissie '); return redirect()->to('/profile'); } diff --git a/app/Views/dashboard.php b/app/Views/dashboard.php index c69ab73f..c2a35465 100644 --- a/app/Views/dashboard.php +++ b/app/Views/dashboard.php @@ -1,7 +1,7 @@
-

Hello, get('firstname') ?>

+

Bonjour, get('firstname') ?>

diff --git a/app/Views/login.php b/app/Views/login.php index 10002bfb..ae898d17 100644 --- a/app/Views/login.php +++ b/app/Views/login.php @@ -2,7 +2,7 @@
-

Login

+

Connexion


get('success')): ?>