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"); + } + }