From ad676024837190d088b27999712af238102ea391 Mon Sep 17 00:00:00 2001 From: Bess1k Date: Tue, 17 Feb 2026 23:17:21 +0100 Subject: [PATCH 1/6] Envoyer mail via mail_message --- controllers/project_controller.php | 164 ++++++++++++++++++----------- 1 file changed, 102 insertions(+), 62 deletions(-) diff --git a/controllers/project_controller.php b/controllers/project_controller.php index af2e9fa..ef05b1b 100644 --- a/controllers/project_controller.php +++ b/controllers/project_controller.php @@ -23,9 +23,20 @@ */ public function home(){ + + + $intCategory = 0; + if (!empty($_GET['filter_cat'])) { + $intCategory = (int) $_GET['filter_cat']; + } + + $boolOld = false; + if (!empty($_GET['filter_old']) && $_GET['filter_old'] == 'true') { + $boolOld = true; + } $objProjectModel = new ProjectModel; - $arrProject = $objProjectModel->findAll(); + $arrProject = $objProjectModel->findAll(0,'',0,0,'','','',$intCategory,$boolOld); $arrProjectToDisplay = array(); foreach($arrProject as $arrDetProject){ $objProject = new Project; @@ -34,8 +45,6 @@ } $this->_arrData['arrProjectToDisplay'] = $arrProjectToDisplay; - - $this->_display("home"); } @@ -43,8 +52,8 @@ /** * Fonction d'affichage de la barre de recherche */ - public function search(){ + //Récupérer les informations du formulaire $strKeywords = $_POST['keywords']??''; $intAuthor = $_POST['author']??0; @@ -76,6 +85,7 @@ $this->_arrData['arrProjectToDisplay'] = $arrProjectToDisplay; $this->_arrData['arrCategory'] = $arrCategory; + $this->_arrData['arrProject'] = $arrProject; $this->_arrData['arrUser'] = $arrUser; @@ -87,62 +97,62 @@ /** * Fonction d'affichage de la page projet */ - - public function project (){ $objProjectModel = new ProjectModel; $arrProject = $objProjectModel->findAll(4); - $arrProjectToDiplay = array(); + $arrProjectToDisplay = array(); foreach($arrProject as $arrDetProject){ $objProject = new Project; $objProject->hydrate($arrDetProject); - $arrProjectToDiplay[] = $objProject; + $arrProjectToDisplay[] = $objProject; } $objImageModel = new ImageModel; $arrImage = $objImageModel->findAllImage(4); - $arrImageToDiplay = array(); + $arrImageToDisplay = array(); foreach($arrImage as $arrDetImage){ $objImage = new Image; $objImage->hydrate($arrDetImage); - $arrImageToDiplay[] = $objImage; + $arrImageToDisplay[] = $objImage; } //Variable data $_SESSION['title'] = $_POST['titleProject']??""; $_SESSION['description'] = $_POST['descProject']??""; $_SESSION['content'] = $_POST['textProject']??""; - $_SESSION['thumbnail'] = $_FILES['imageProject']['name']??""; + $_SESSION['thumbnail'] = $_FILES['imageThumbnail']['name']??""; $_SESSION['status'] = 'en_attente'; + $_SESSION['user_id'] = $_SESSION['user']['user_id']; $objProject = new Project(); /** - /* Créer par Besnik le GOAT et l'autre GOAT de Guillaume - /* - /* @return bool pour savoir si le fichier existe, - /* puis déplace vers le fichier uploads avec les images projet des utilisateurs - /* Communication avec la BDD + * Créer par Besnik le GOAT et l'autre GOAT de Guillaume + * + * @return bool pour savoir si le fichier existe, + * puis déplace vers le fichier uploads avec les images projet des utilisateurs + * Communication avec la BDD */ if (($_SESSION['thumbnail'] != null)){ $strDest = ""; if ((count($_FILES) > 0) && ($_FILES['imageProject']['error'] != 4)){ - $strDest = '../public/uploads/projects/'.$_FILES['imageProject']['name']; - var_dump($strDest); + $strDest = 'uploads/projects/'.$_FILES['imageProject']['name']; move_uploaded_file($_FILES['imageProject']['tmp_name'], $strDest); } } /** En cas d'appuis sur le bouton d'envoie ou celui de remettre a plus tard - /* 1. Changement de status - /* 2. Hydratation avec les informations récupéré de l'utilisateur - /* 3. Envoie des données à la BDD - */ + * 1. Changement de status + * 2. Hydratation avec les informations récupéré de l'utilisateur + * 3. Envoie des données à la BDD + */ if (isset($_POST['sendMessage'])) { $_SESSION['status'] = 'publié'; $objProject->hydrate($_SESSION); - $objProject->setThumbnail($strDest); + $objProject->setThumbnail($strDest); + var_dump($strDest); + var_dump($objProject); $objProjectModel->insert($objProject); } else if (isset($_POST['toContinue'])) { @@ -151,14 +161,12 @@ $objProjectModel->insert($objProject); } - //Débuggage var_dump($_SESSION); var_dump($objProject); - $this->_arrData['arrProjectToDiplay'] = $arrProjectToDiplay; - $this->_arrData['arrImageToDiplay'] = $arrImageToDiplay; + $this->_arrData['arrProjectToDiplay'] = $arrProjectToDisplay; + $this->_arrData['arrImageToDiplay'] = $arrImageToDisplay; $this->_display("project"); - } @@ -174,7 +182,7 @@ $objProject->hydrate($arrProject); $this->_arrData["objProject"] = $objProject; - $this->_display("projet_display"); + $this->_display("project_display"); } else { header("Location: index.php?ctrl=project&action=home"); exit; @@ -187,16 +195,11 @@ public function sendEmail() { - if (count($_POST) > 0) { - + if (count($_POST) > 0) + { $projectId = (int)($_POST['project_id'] ?? 0); $toEmail = trim($_POST['to_email'] ?? ''); - if ($projectId <= 0 || !filter_var($toEmail, FILTER_VALIDATE_EMAIL)) { - header("Location: index.php?ctrl=project&action=display&id=".$projectId."&mail=fail"); - exit; - } - $objProjectModel = new ProjectModel(); $arrProject = $objProjectModel->findOne($projectId); @@ -208,46 +211,37 @@ $objProject = new Project(); $objProject->hydrate($arrProject); - - - $objMail = new PHPMailer(); // Nouvel objet Mail + $objMail = new PHPMailer(); $objMail->IsSMTP(); - $objMail->Mailer = "smtp"; - $objMail->CharSet = PHPMailer::CHARSET_UTF8; + $objMail->Mailer = "smtp"; + $objMail->CharSet = PHPMailer::CHARSET_UTF8; + $objMail->SMTPDebug = 0; - $objMail->SMTPDebug = 0; - - $objMail->SMTPAuth = TRUE; - $objMail->SMTPSecure = "tls"; - $objMail->Port = 587; - $objMail->Host = "smtp.gmail.com"; - $objMail->Username = "projet.folliow@gmail.com"; - $objMail->Password = "dqnw mqbu cwvg enbp"; + $objMail->SMTPAuth = true; + $objMail->SMTPSecure = "tls"; + $objMail->Port = 587; + $objMail->Host = 'smtp-relay.brevo.com'; + $objMail->Username = 'a2a67e001@smtp-brevo.com'; + $objMail->Password = 'xsmtpsib-f2af87e12d3db6f1b99802a92c1acda32d45fc32a8446eeed7e49ec91c4ec7ef-AX8Y7YkRWYSmKHwS'; $objMail->IsHTML(true); - - $objMail->setFrom('projet.folliow@gmail.com', 'Projet Folliow'); - - - // Destinataire + $objMail->setFrom('projet.folliow@hotmail.com', 'Folliow'); $objMail->addAddress($toEmail); - // Mail $objMail->Subject = "Projet : " . $objProject->getTitle(); - $url = "http://localhost/projet_php/public/index.php?ctrl=project&action=display&id=" . $projectId; + $url = "https://php.boulayoune.com/index.php?ctrl=project&action=display&id=" . $projectId; - $objMail->Body = - "

" . $objProject->getTitle() . "

" . - "

" . $objProject->getDescription() . "

" . - "

Voir le projet

"; + $this->_arrData['projectTitle'] = $objProject->getTitle(); + $this->_arrData['projectDescription'] = $objProject->getDescription(); + $this->_arrData['projectUrl'] = $url; + + $objMail->Body = $this->_display("mail_message", false); - // Envoi + redirection if ($objMail->Send()) { header("Location: index.php?ctrl=project&action=display&id=".$projectId."&mail=ok"); } else { - // Pour debug si besoin: echo $objMail->ErrorInfo; exit; header("Location: index.php?ctrl=project&action=display&id=".$projectId."&mail=fail"); } exit; @@ -256,4 +250,50 @@ header("Location: index.php?ctrl=project&action=home"); exit; } - } \ No newline at end of file + + + + + + public function accept(){ + + //Récupéré l'id dans l'url + $intId = $_GET['id']; + + //Je créer un nouveau model pour exec la commande SQL + $objProjectModel = new ProjectModel; + $objProjectModel->accept($intId); + + //Redirection vers la page + header("Location: index.php"); + exit; + } + + public function refuse(){ + + //Récupéré l'id dans l'url + $intId = $_GET['id']; + + //Je créer un nouveau model pour exec la commande SQL + $objProjectModel = new ProjectModel; + $objProjectModel->refuse($intId); + + //Redirection vers la page + header("Location: index.php"); + exit; + } + + public function delete(){ + + //Récupéré l'id dans l'url + $intId = $_GET['id']; + + //Je créer un nouveau model pour exec la commande SQL + $objProjectModel = new ProjectModel; + $objProjectModel->delete($intId); + + //Redirection vers la page + header("Location: index.php"); + exit; + } + } From 48510edae88c537bef85867bf016f941413190f2 Mon Sep 17 00:00:00 2001 From: Bess1k Date: Tue, 17 Feb 2026 23:25:06 +0100 Subject: [PATCH 2/6] changer le nom de fonction pour partage projet --- controllers/project_controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/project_controller.php b/controllers/project_controller.php index ef05b1b..104fecd 100644 --- a/controllers/project_controller.php +++ b/controllers/project_controller.php @@ -193,7 +193,7 @@ } } - public function sendEmail() + public function shareProject() { if (count($_POST) > 0) { From 9f4a2c0b7e7f2a67fa03f4b56cd65fa2d894495a Mon Sep 17 00:00:00 2001 From: Bess1k Date: Tue, 17 Feb 2026 23:25:43 +0100 Subject: [PATCH 3/6] Update projet_display.tpl --- views/projet_display.tpl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/views/projet_display.tpl b/views/projet_display.tpl index 21301dc..1e831c7 100644 --- a/views/projet_display.tpl +++ b/views/projet_display.tpl @@ -35,9 +35,9 @@ - +
-
+ @@ -58,11 +58,11 @@
- - - + + +
{$objProject->getCreatorName()}

@@ -76,4 +76,4 @@

-{/block} \ No newline at end of file +{/block} From 5e3b6ee148fd4d4602ea88aa90fb3823d7db8b50 Mon Sep 17 00:00:00 2001 From: Bess1k Date: Tue, 17 Feb 2026 23:26:33 +0100 Subject: [PATCH 4/6] Add files via upload --- views/mail_message.tpl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 views/mail_message.tpl diff --git a/views/mail_message.tpl b/views/mail_message.tpl new file mode 100644 index 0000000..4d4a618 --- /dev/null +++ b/views/mail_message.tpl @@ -0,0 +1,26 @@ +

Bonjour,

+ +

+ Un projet a été partagé avec vous via la plateforme Folliow. +

+ +

{$projectTitle}

+ +

+ {$projectDescription} +

+ +

+ Vous pouvez consulter le projet en cliquant sur le lien ci-dessous : +

+ +

+ + {$projectUrl} + +

+ +

+ Cordialement,
+ L’équipe Folliow +

From 009191494e788a56ac744ac177ad6f44d6f7d2cb Mon Sep 17 00:00:00 2001 From: Bess1k Date: Fri, 20 Feb 2026 15:20:12 +0100 Subject: [PATCH 5/6] Add files via upload --- views/layout.tpl | 7 +- views/mentions.tpl | 287 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 291 insertions(+), 3 deletions(-) create mode 100644 views/mentions.tpl diff --git a/views/layout.tpl b/views/layout.tpl index b3094fd..5c6c9a6 100644 --- a/views/layout.tpl +++ b/views/layout.tpl @@ -1,7 +1,8 @@ {include file="views/_partial/header.tpl"} -{block name="content"} - -{/block} +
+ {block name="content"} + {/block} +
{include file="views/_partial/footer.tpl"} \ No newline at end of file diff --git a/views/mentions.tpl b/views/mentions.tpl new file mode 100644 index 0000000..ad5d4c9 --- /dev/null +++ b/views/mentions.tpl @@ -0,0 +1,287 @@ +{extends file="views/layout.tpl"} + +{block name="title" append}Mentions légales{/block} +{block name="h2"}Mentions légales{/block} +{block name="p"}Informations légales et politique de confidentialité{/block} + +{block name="date_maj"} +

+ + Dernière mise à jour : +

+{/block} + +{block name="js_footer" append} + +{/block} + +{block name="content"} +
+

Mentions légales

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ Pour toute question concernant ces mentions légales ou pour exercer vos droits, vous pouvez nous contacter : +

+ +
+ +
+
+
+{/block} \ No newline at end of file From 5efc3c577868f2d186552d124b10c05a8ff95074 Mon Sep 17 00:00:00 2001 From: Bess1k Date: Fri, 20 Feb 2026 15:22:10 +0100 Subject: [PATCH 6/6] =?UTF-8?q?Debugge=20partage=20projet,=20cr=C3=A9e=20p?= =?UTF-8?q?ages=20mentions=20et=20about.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/project_controller.php | 61 ++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/controllers/project_controller.php b/controllers/project_controller.php index 104fecd..773aabb 100644 --- a/controllers/project_controller.php +++ b/controllers/project_controller.php @@ -193,52 +193,60 @@ } } - public function shareProject() - { + public function shareProject(){ if (count($_POST) > 0) { $projectId = (int)($_POST['project_id'] ?? 0); $toEmail = trim($_POST['to_email'] ?? ''); - + $objProjectModel = new ProjectModel(); $arrProject = $objProjectModel->findOne($projectId); - + if (!$arrProject) { header("Location: index.php?ctrl=project&action=home"); exit; } - + $objProject = new Project(); $objProject->hydrate($arrProject); - + $objMail = new PHPMailer(); $objMail->IsSMTP(); $objMail->Mailer = "smtp"; $objMail->CharSet = PHPMailer::CHARSET_UTF8; - $objMail->SMTPDebug = 0; - + $objMail->SMTPDebug = 0; + $objMail->SMTPAuth = true; $objMail->SMTPSecure = "tls"; $objMail->Port = 587; $objMail->Host = 'smtp-relay.brevo.com'; $objMail->Username = 'a2a67e001@smtp-brevo.com'; $objMail->Password = 'xsmtpsib-f2af87e12d3db6f1b99802a92c1acda32d45fc32a8446eeed7e49ec91c4ec7ef-AX8Y7YkRWYSmKHwS'; - + + // Désactive la vérification du certificat SSL + // Cela permet d'éviter les erreurs liées au certificat, mais réduit la sécurité de la connexion. + $objMail->SMTPOptions = [ + 'ssl' => [ + 'verify_peer' => false, + ], + ]; + + $objMail->IsHTML(true); - + $objMail->setFrom('projet.folliow@hotmail.com', 'Folliow'); $objMail->addAddress($toEmail); - + $objMail->Subject = "Projet : " . $objProject->getTitle(); - + $url = "https://php.boulayoune.com/index.php?ctrl=project&action=display&id=" . $projectId; - + $this->_arrData['projectTitle'] = $objProject->getTitle(); $this->_arrData['projectDescription'] = $objProject->getDescription(); $this->_arrData['projectUrl'] = $url; - + $objMail->Body = $this->_display("mail_message", false); - + if ($objMail->Send()) { header("Location: index.php?ctrl=project&action=display&id=".$projectId."&mail=ok"); } else { @@ -246,14 +254,11 @@ } exit; } - + header("Location: index.php?ctrl=project&action=home"); exit; } - - - public function accept(){ @@ -296,4 +301,22 @@ header("Location: index.php"); exit; } + + /** + * Page mentions légales + */ + public function mentions(){ + // Afficher + $this->_display("mentions"); + } + + + /** + * Page à propos + */ + public function about(){ + // Afficher + $this->_display("about"); + } + }