commit
46c6d53651
10 changed files with 998 additions and 1023 deletions
|
|
@ -8,62 +8,14 @@
|
||||||
|
|
||||||
class UserCtrl extends MotherCtrl {
|
class UserCtrl extends MotherCtrl {
|
||||||
|
|
||||||
public function login(){
|
/**
|
||||||
|
* Fonction d'inscription d'un utilisateur
|
||||||
$strMail = $_POST['user_mail']??"";
|
* Effectue les validations du formulaire,
|
||||||
$strPwd = $_POST['user_password']??"";
|
* vérifie l'unicité du mail et du pseudo,
|
||||||
|
* puis insère l'utilisateur en base de données
|
||||||
// Tester le formulaire
|
* @return void
|
||||||
$arrError = [];
|
*/
|
||||||
if (count($_POST) > 0) {
|
public function signup(){
|
||||||
// Vérifier le formulaire
|
|
||||||
if ($strMail == ""){
|
|
||||||
$arrError['mail'] = "Le mail est obligatoire";
|
|
||||||
}
|
|
||||||
if ($strPwd == ""){
|
|
||||||
$arrError['pwd'] = "Le mot de passe est obligatoire";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si le formulaire est rempli correctement
|
|
||||||
if (count($arrError) == 0){
|
|
||||||
// Vérifier l'utilisateur en BDD
|
|
||||||
$objUserModel = new UserModel;
|
|
||||||
$arrResult = $objUserModel->verifUser($strMail, $strPwd);
|
|
||||||
//var_dump($arrResult);
|
|
||||||
if ($arrResult === false){ // Si la base de données ne renvoie rien
|
|
||||||
$arrError[] = "Mail ou mot de passe invalide";
|
|
||||||
}else{
|
|
||||||
// Ajoute l'utilisateur en session
|
|
||||||
$_SESSION['user'] = $arrResult;
|
|
||||||
$_SESSION['success'] = "Bienvenue, vous êtes bien connecté";
|
|
||||||
|
|
||||||
header("Location:index.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->_arrData['arrError'] = $arrError;
|
|
||||||
$this->_display("login");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function logout(){
|
|
||||||
session_start();
|
|
||||||
/*session_destroy();
|
|
||||||
session_start();*/
|
|
||||||
|
|
||||||
// on supprime l'utilisateur en session
|
|
||||||
unset($_SESSION['user']);
|
|
||||||
|
|
||||||
$_SESSION['success'] = "Vous êtes bien déconnecté";
|
|
||||||
|
|
||||||
header("Location:index.php");
|
|
||||||
exit;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function signin(){
|
|
||||||
|
|
||||||
// Entité pour réafficher les valeurs dans le formulaire
|
// Entité pour réafficher les valeurs dans le formulaire
|
||||||
$objUser = new User();
|
$objUser = new User();
|
||||||
|
|
@ -101,33 +53,40 @@ class UserCtrl extends MotherCtrl {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim($objUser->getMail()) === "") {
|
if (trim($objUser->getMail()) === "") {
|
||||||
$arrError['user_mail'] = "Le mail est obligatoire";
|
$arrError['user_mail'] = "L'adresse e-mail est obligatoire";
|
||||||
} elseif (!filter_var($objUser->getMail(), FILTER_VALIDATE_EMAIL)) {
|
} elseif (!filter_var($objUser->getMail(), FILTER_VALIDATE_EMAIL)) {
|
||||||
$arrError['user_mail'] = "Le format du mail n'est pas correct";
|
$arrError['user_mail'] = "Le format de l'adresse e-mail est invalide";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim($objUser->getPseudo()) === "") {
|
if (trim($objUser->getPseudo()) === "") {
|
||||||
$arrError['user_pseudo'] = "Le pseudo est obligatoire";
|
$arrError['user_pseudo'] = "Le pseudo est obligatoire";
|
||||||
}
|
}
|
||||||
|
|
||||||
$strRegex = "/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{16,}$/";
|
$strRegex = "/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{15,}$/";
|
||||||
if ($objUser->getPwd() == ""){
|
if ($objUser->getPwd() == ""){
|
||||||
$arrError['user_password'] = "Le mot de passe est obligatoire";
|
$arrError['user_password'] = "Le mot de passe est obligatoire";
|
||||||
}else if (!preg_match($strRegex, $objUser->getPwd())){
|
}else if (!preg_match($strRegex, $objUser->getPwd())){
|
||||||
$arrError['user_password'] = "Le mot de passe ne correspond pas aux règles";
|
$arrError['user_password'] = "Le mot de passe ne respecte pas les critères";
|
||||||
}else if($objUser->getPwd() != $strPwdConfirm){
|
}else if($objUser->getPwd() != $strPwdConfirm){
|
||||||
$arrError['pwd_confirm'] = "Le mot de passe et sa confirmation ne sont pas identiques";
|
$arrError['pwd_confirm'] = "La confirmation du mot de passe ne correspond pas";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Si pas d'erreurs => insertion
|
// Si pas d'erreurs => insertion
|
||||||
if (count($arrError) === 0) {
|
if (count($arrError) === 0) {
|
||||||
$objUserModel = new UserModel();
|
$objUserModel = new UserModel();
|
||||||
|
|
||||||
|
// Vérif mail
|
||||||
if ($objUserModel->mailExists($objUser->getMail())) {
|
if ($objUserModel->mailExists($objUser->getMail())) {
|
||||||
|
$arrError['user_mail'] = "Impossible de créer le compte avec ces informations";
|
||||||
|
}
|
||||||
|
|
||||||
$arrError['user_mail'] = "Ce mail existe déjà";
|
// Vérif pseudo
|
||||||
} else {
|
if ($objUserModel->pseudoExists($objUser->getPseudo())) {
|
||||||
|
$arrError['user_pseudo'] = "Ce pseudo existe déjà";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si aucune erreur => insert
|
||||||
|
if (count($arrError) === 0) {
|
||||||
$boolInsert = $objUserModel->insert($objUser);
|
$boolInsert = $objUserModel->insert($objUser);
|
||||||
|
|
||||||
if ($boolInsert === true) {
|
if ($boolInsert === true) {
|
||||||
|
|
@ -142,172 +101,236 @@ class UserCtrl extends MotherCtrl {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affichage de la vue inscription
|
// Affichage de la vue inscription
|
||||||
$this->_arrData["arrError"] = $arrError;
|
$this->_arrData['objUser'] = $objUser;
|
||||||
$this->_display("inscription");
|
$this->_arrData['arrError'] = $arrError;
|
||||||
|
$this->_display("signup");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* le controlleur affichage de la page user
|
* Fonction de connexion d'un utilisateur
|
||||||
*/
|
* Vérifie les informations envoyées par le formulaire
|
||||||
public function user(){
|
* et crée la session si les identifiants sont valides
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function login(){
|
||||||
|
|
||||||
/**$intId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
$strMail = $_POST['user_mail']??"";
|
||||||
|
$strPwd = $_POST['user_password']??"";
|
||||||
|
|
||||||
if ($intId <= 0) {
|
// Tester le formulaire
|
||||||
header("Location: index.php");
|
$arrError = [];
|
||||||
exit;
|
if (count($_POST) > 0) {
|
||||||
}
|
// Vérifier le formulaire
|
||||||
|
if ($strMail == ""){
|
||||||
|
$arrError['mail'] = "L'adresse e-mail est obligatoire";
|
||||||
|
}
|
||||||
|
if ($strPwd == ""){
|
||||||
|
$arrError['pwd'] = "Le mot de passe est obligatoire";
|
||||||
|
}
|
||||||
|
|
||||||
//affichage info utilisateur
|
// Si le formulaire est rempli correctement
|
||||||
$objUserModel = new UserModel;
|
if (count($arrError) == 0){
|
||||||
$arrUserData = $objUserModel->findUserById($intId);
|
// Vérifier l'utilisateur en BDD
|
||||||
|
$objUserModel = new UserModel;
|
||||||
|
$arrResult = $objUserModel->verifUser($strMail, $strPwd);
|
||||||
|
//var_dump($arrResult);
|
||||||
|
if ($arrResult === false){ // Si la base de données ne renvoie rien
|
||||||
|
$arrError[] = "Identifiants incorrects";
|
||||||
|
}else{
|
||||||
|
// Ajoute l'utilisateur en session
|
||||||
|
$_SESSION['user'] = $arrResult;
|
||||||
|
$_SESSION['success'] = "Bienvenue, vous êtes bien connecté";
|
||||||
|
|
||||||
if ($arrUserData === false) {
|
header("Location:index.php");
|
||||||
header("Location: index.php");
|
exit;
|
||||||
exit;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$strPseudo = $_GET['pseudo']??'';
|
|
||||||
|
|
||||||
$objUserModel = new UserModel;
|
|
||||||
$arrUserData = $objUserModel->findUserByPseudo($strPseudo);
|
|
||||||
|
|
||||||
if ($arrUserData === false) {
|
|
||||||
header("Location: index.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$objUser = new User;
|
|
||||||
$objUser->hydrate($arrUserData);
|
|
||||||
|
|
||||||
//affichage projet de l'utilisateur
|
|
||||||
$objProjectModel = new ProjectModel;
|
|
||||||
$arrProjects = $objProjectModel->findAll(0,'',$objUser->getId());
|
|
||||||
|
|
||||||
$arrProjectToDisplay = array();
|
|
||||||
foreach($arrProjects as $projectData) {
|
|
||||||
$objProject = new Project();
|
|
||||||
$objProject->hydrate($projectData);
|
|
||||||
$arrProjectToDisplay[] = $objProject;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_arrData['user'] = $objUser;
|
|
||||||
$this->_arrData['arrProjectToDisplay'] = $arrProjectToDisplay;
|
|
||||||
$this->_display("user");
|
|
||||||
}
|
|
||||||
|
|
||||||
public function edit(){
|
|
||||||
if(!isset($_SESSION['user'])){
|
|
||||||
header("Location: index.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$objUserModel = new UserModel;
|
|
||||||
$arrError = [];
|
|
||||||
$objUser = new User;
|
|
||||||
$arrUserData = $objUserModel->findUserById($_SESSION['user']['user_id']);
|
|
||||||
$objUser->hydrate($arrUserData);
|
|
||||||
if (!empty($_POST)) {
|
|
||||||
if ($objUserModel->mailExists($_POST['user_mail']) && ($_POST['user_mail'] != $objUser->getMail())) {
|
|
||||||
|
|
||||||
$arrError['user_mail'] = "Ce mail est déjà associé";
|
|
||||||
} else {
|
|
||||||
if ($objUserModel->pseudoExists($_POST['user_pseudo']) && ($_POST['user_pseudo'] != $objUser->getPseudo())){
|
|
||||||
$arrError['user_pseudo'] = "Ce pseudo est déjà utiliser";
|
|
||||||
}else{
|
|
||||||
$objUser->hydrate($_POST);
|
|
||||||
$objUser->setId($_SESSION['user']['user_id']);
|
|
||||||
|
|
||||||
// Vérification de l'image
|
|
||||||
$arrTypeAllowed = array('image/jpeg', 'image/png', 'image/webp');
|
|
||||||
$boolImageOk = true;
|
|
||||||
|
|
||||||
if ($_FILES['image']['error'] != 4) {
|
|
||||||
if (!in_array($_FILES['image']['type'], $arrTypeAllowed)) {
|
|
||||||
$arrError['image'] = "Le type de fichier n'est pas autorisé";
|
|
||||||
} else {
|
|
||||||
switch ($_FILES['image']['error']) {
|
|
||||||
case 0:
|
|
||||||
$strImageName = uniqid() . ".webp";
|
|
||||||
$strOldImg = $objUser->getImage();
|
|
||||||
$objUser->setImage($strImageName);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
$arrError['image'] = "Le fichier est trop volumineux";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
$arrError['image'] = "Le fichier a été partiellement téléchargé";
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
$arrError['image'] = "Le répertoire temporaire est manquant";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$arrError['image'] = "Erreur sur l'image";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Traitement de l'image si pas d'erreur
|
|
||||||
if (count($arrError) == 0 && isset($strImageName)) {
|
|
||||||
$strDest = $_ENV['IMG_USER_PATH'] . $strImageName;
|
|
||||||
$strSource = $_FILES['image']['tmp_name'];
|
|
||||||
list($intWidth, $intHeight) = getimagesize($strSource);
|
|
||||||
|
|
||||||
$intDestWidth = 200; $intDestHeight = 200;
|
|
||||||
$fltDestRatio = $intDestWidth / $intDestHeight;
|
|
||||||
$fltSourceRatio = $intWidth / $intHeight;
|
|
||||||
|
|
||||||
if ($fltSourceRatio > $fltDestRatio) {
|
|
||||||
$intCropHeight = $intHeight;
|
|
||||||
$intCropWidth = (int)round($intHeight * $fltDestRatio);
|
|
||||||
$intCropX = (int)(($intWidth - $intCropWidth) / 2);
|
|
||||||
$intCropY = 0;
|
|
||||||
} else {
|
|
||||||
$intCropWidth = $intWidth;
|
|
||||||
$intCropHeight = (int)round($intWidth / $fltDestRatio);
|
|
||||||
$intCropX = 0;
|
|
||||||
$intCropY = (int)(($intHeight - $intCropHeight) / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
$objDest = imagecreatetruecolor($intDestWidth, $intDestHeight);
|
|
||||||
switch ($_FILES['image']['type']) {
|
|
||||||
case 'image/jpeg': $objSource = imagecreatefromjpeg($strSource); break;
|
|
||||||
case 'image/png': $objSource = imagecreatefrompng($strSource); break;
|
|
||||||
case 'image/webp': $objSource = imagecreatefromwebp($strSource); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
imagecopyresampled($objDest, $objSource, 0, 0, $intCropX, $intCropY, $intDestWidth, $intDestHeight, $intCropWidth, $intCropHeight);
|
|
||||||
$boolImageOk = imagewebp($objDest, $strDest);
|
|
||||||
imagedestroy($objDest);
|
|
||||||
imagedestroy($objSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$boolInsert = $objUserModel->update($objUser);
|
|
||||||
|
|
||||||
if ($boolInsert === true) {
|
|
||||||
if (isset($strOldImg) && !empty($strOldImg) && isset($strImageName)) {
|
|
||||||
$strOldFile = $_ENV['IMG_USER_PATH'] . $strOldImg;
|
|
||||||
if (file_exists($strOldFile)) unlink($strOldFile);
|
|
||||||
}
|
|
||||||
$arrNewInfo = $objUserModel->findUserByPseudo($objUser->getPseudo());
|
|
||||||
$_SESSION['user'] = $arrNewInfo;
|
|
||||||
$_SESSION['success'] = "Compte modifier avec succès";
|
|
||||||
header("Location:?ctrl=user&action=user&pseudo=".$objUser->getPseudo());
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
$arrError['global'] = "Erreur lors de l'update";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->_arrData['arrError'] = $arrError;
|
||||||
|
$this->_display("login");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_arrData["arrError"] = $arrError;
|
|
||||||
$this->_arrData['objUser'] = $objUser;
|
|
||||||
$this->_display("useredit");
|
|
||||||
|
|
||||||
}
|
public function logout(){
|
||||||
|
session_start();
|
||||||
|
/*session_destroy();
|
||||||
|
session_start();*/
|
||||||
|
|
||||||
|
// on supprime l'utilisateur en session
|
||||||
|
unset($_SESSION['user']);
|
||||||
|
|
||||||
|
$_SESSION['success'] = "Vous êtes bien déconnecté";
|
||||||
|
|
||||||
|
header("Location:index.php");
|
||||||
|
exit;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* le controlleur affichage de la page user
|
||||||
|
*/
|
||||||
|
public function user(){
|
||||||
|
|
||||||
|
/**$intId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||||
|
|
||||||
|
if ($intId <= 0) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//affichage info utilisateur
|
||||||
|
$objUserModel = new UserModel;
|
||||||
|
$arrUserData = $objUserModel->findUserById($intId);
|
||||||
|
|
||||||
|
if ($arrUserData === false) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
$strPseudo = $_GET['pseudo']??'';
|
||||||
|
|
||||||
|
$objUserModel = new UserModel;
|
||||||
|
$arrUserData = $objUserModel->findUserByPseudo($strPseudo);
|
||||||
|
|
||||||
|
if ($arrUserData === false) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$objUser = new User;
|
||||||
|
$objUser->hydrate($arrUserData);
|
||||||
|
|
||||||
|
//affichage projet de l'utilisateur
|
||||||
|
$objProjectModel = new ProjectModel;
|
||||||
|
$arrProjects = $objProjectModel->findAll(0,'',$objUser->getId());
|
||||||
|
|
||||||
|
$arrProjectToDisplay = array();
|
||||||
|
foreach($arrProjects as $projectData) {
|
||||||
|
$objProject = new Project();
|
||||||
|
$objProject->hydrate($projectData);
|
||||||
|
$arrProjectToDisplay[] = $objProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_arrData['user'] = $objUser;
|
||||||
|
$this->_arrData['arrProjectToDisplay'] = $arrProjectToDisplay;
|
||||||
|
$this->_display("user");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(){
|
||||||
|
if(!isset($_SESSION['user'])){
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$objUserModel = new UserModel;
|
||||||
|
$arrError = [];
|
||||||
|
$objUser = new User;
|
||||||
|
$arrUserData = $objUserModel->findUserById($_SESSION['user']['user_id']);
|
||||||
|
$objUser->hydrate($arrUserData);
|
||||||
|
if (!empty($_POST)) {
|
||||||
|
if ($objUserModel->mailExists($_POST['user_mail']) && ($_POST['user_mail'] != $objUser->getMail())) {
|
||||||
|
|
||||||
|
$arrError['user_mail'] = "Ce mail est déjà associé";
|
||||||
|
} else {
|
||||||
|
if ($objUserModel->pseudoExists($_POST['user_pseudo']) && ($_POST['user_pseudo'] != $objUser->getPseudo())){
|
||||||
|
$arrError['user_pseudo'] = "Ce pseudo est déjà utiliser";
|
||||||
|
}else{
|
||||||
|
$objUser->hydrate($_POST);
|
||||||
|
$objUser->setId($_SESSION['user']['user_id']);
|
||||||
|
|
||||||
|
// Vérification de l'image
|
||||||
|
$arrTypeAllowed = array('image/jpeg', 'image/png', 'image/webp');
|
||||||
|
$boolImageOk = true;
|
||||||
|
|
||||||
|
if ($_FILES['image']['error'] != 4) {
|
||||||
|
if (!in_array($_FILES['image']['type'], $arrTypeAllowed)) {
|
||||||
|
$arrError['image'] = "Le type de fichier n'est pas autorisé";
|
||||||
|
} else {
|
||||||
|
switch ($_FILES['image']['error']) {
|
||||||
|
case 0:
|
||||||
|
$strImageName = uniqid() . ".webp";
|
||||||
|
$strOldImg = $objUser->getImage();
|
||||||
|
$objUser->setImage($strImageName);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
$arrError['image'] = "Le fichier est trop volumineux";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$arrError['image'] = "Le fichier a été partiellement téléchargé";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
$arrError['image'] = "Le répertoire temporaire est manquant";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$arrError['image'] = "Erreur sur l'image";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Traitement de l'image si pas d'erreur
|
||||||
|
if (count($arrError) == 0 && isset($strImageName)) {
|
||||||
|
$strDest = $_ENV['IMG_USER_PATH'] . $strImageName;
|
||||||
|
$strSource = $_FILES['image']['tmp_name'];
|
||||||
|
list($intWidth, $intHeight) = getimagesize($strSource);
|
||||||
|
|
||||||
|
$intDestWidth = 200; $intDestHeight = 200;
|
||||||
|
$fltDestRatio = $intDestWidth / $intDestHeight;
|
||||||
|
$fltSourceRatio = $intWidth / $intHeight;
|
||||||
|
|
||||||
|
if ($fltSourceRatio > $fltDestRatio) {
|
||||||
|
$intCropHeight = $intHeight;
|
||||||
|
$intCropWidth = (int)round($intHeight * $fltDestRatio);
|
||||||
|
$intCropX = (int)(($intWidth - $intCropWidth) / 2);
|
||||||
|
$intCropY = 0;
|
||||||
|
} else {
|
||||||
|
$intCropWidth = $intWidth;
|
||||||
|
$intCropHeight = (int)round($intWidth / $fltDestRatio);
|
||||||
|
$intCropX = 0;
|
||||||
|
$intCropY = (int)(($intHeight - $intCropHeight) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
$objDest = imagecreatetruecolor($intDestWidth, $intDestHeight);
|
||||||
|
switch ($_FILES['image']['type']) {
|
||||||
|
case 'image/jpeg': $objSource = imagecreatefromjpeg($strSource); break;
|
||||||
|
case 'image/png': $objSource = imagecreatefrompng($strSource); break;
|
||||||
|
case 'image/webp': $objSource = imagecreatefromwebp($strSource); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
imagecopyresampled($objDest, $objSource, 0, 0, $intCropX, $intCropY, $intDestWidth, $intDestHeight, $intCropWidth, $intCropHeight);
|
||||||
|
$boolImageOk = imagewebp($objDest, $strDest);
|
||||||
|
imagedestroy($objDest);
|
||||||
|
imagedestroy($objSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$boolInsert = $objUserModel->update($objUser);
|
||||||
|
|
||||||
|
if ($boolInsert === true) {
|
||||||
|
if (isset($strOldImg) && !empty($strOldImg) && isset($strImageName)) {
|
||||||
|
$strOldFile = $_ENV['IMG_USER_PATH'] . $strOldImg;
|
||||||
|
if (file_exists($strOldFile)) unlink($strOldFile);
|
||||||
|
}
|
||||||
|
$arrNewInfo = $objUserModel->findUserByPseudo($objUser->getPseudo());
|
||||||
|
$_SESSION['user'] = $arrNewInfo;
|
||||||
|
$_SESSION['success'] = "Compte modifier avec succès";
|
||||||
|
header("Location:?ctrl=user&action=user&pseudo=".$objUser->getPseudo());
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$arrError['global'] = "Erreur lors de l'update";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_arrData["arrError"] = $arrError;
|
||||||
|
$this->_arrData['objUser'] = $objUser;
|
||||||
|
$this->_display("useredit");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<li><a href="#">Découvrir</a>
|
<li><a href="#">Découvrir</a>
|
||||||
<li><a href="#">Customisation</a>
|
<li><a href="#">Customisation</a>
|
||||||
<li><a href="#">Emploi</a>
|
<li><a href="#">Emploi</a>
|
||||||
<li><a href="#">A propos</a>
|
<li><a href="?ctrl=project&action=about">A propos</a>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#">Politique de confidentialité</a>
|
<li><a href="#">Politique de confidentialité</a>
|
||||||
<li><a href="#">Politique sur les données</a>
|
<li><a href="?ctrl=project&action=mentions">Mentions légales</a>
|
||||||
<li><a href="#">CGU</a>
|
<li><a href="#">CGU</a>
|
||||||
<li><a href="#">CGV</a>
|
<li><a href="#">CGV</a>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
|
||||||
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
|
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
|
||||||
<title>Folliow</title>
|
<title>Folliow{block name="title"}{/block}</title>
|
||||||
</head>
|
</head>
|
||||||
<body class="d-flex flex-column min-vh-100">
|
<body class="d-flex flex-column min-vh-100">
|
||||||
<nav class="navbar navbar-expand-lg navbar-light">
|
<nav class="navbar navbar-expand-lg navbar-light">
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
{* Utilisateur non connecté *}
|
{* Utilisateur non connecté *}
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="index.php?ctrl=user&action=signin" title="Créer un compte" aria-label="Créer un compte">
|
<a class="nav-link" href="index.php?ctrl=user&action=signup" title="Créer un compte" aria-label="Créer un compte">
|
||||||
S'inscrire
|
S'inscrire
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
{extends file="views/layout.tpl"}
|
{extends file="views/layout.tpl"}
|
||||||
|
|
||||||
{assign var='strPage' value='about'}
|
{block name="title" append} - À propos{/block}
|
||||||
|
|
||||||
{block name="title" append}À propos{/block}
|
|
||||||
{block name="h2"}À propos de FOLLIOW{/block}
|
{block name="h2"}À propos de FOLLIOW{/block}
|
||||||
{block name="p"}Plateforme de partage de projets – Projet pédagogique{/block}
|
{block name="p"}Plateforme de partage de projets – Projet pédagogique{/block}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,197 +0,0 @@
|
||||||
{extends file="views/layout.tpl"}
|
|
||||||
|
|
||||||
{block name="content"}
|
|
||||||
<!-- Page : Inscription -->
|
|
||||||
|
|
||||||
|
|
||||||
<main class="container py-5">
|
|
||||||
|
|
||||||
<!-- Centrage horizontal du formulaire -->
|
|
||||||
<div class="row justify-content-center position-relative">
|
|
||||||
<div class="col-12 col-md-10 col-lg-6">
|
|
||||||
|
|
||||||
<!-- Carte contenant le formulaire d'inscription -->
|
|
||||||
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
|
|
||||||
|
|
||||||
<!-- Titre principal de la page -->
|
|
||||||
<h1 class="h3 fw-bold mb-1">Inscription</h1>
|
|
||||||
|
|
||||||
<!-- Texte descriptif -->
|
|
||||||
<p class="text-secondary mb-4">
|
|
||||||
Créez votre compte utilisateur.
|
|
||||||
</p>
|
|
||||||
{if (isset($arrError) && count($arrError) > 0) }
|
|
||||||
<div class="alert alert-danger">
|
|
||||||
{foreach $arrError as $strError}
|
|
||||||
<p>{$strError}</p>
|
|
||||||
{/foreach}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<!-- Formulaire d'inscription -->
|
|
||||||
<!-- Les données seront traitées côté serveur en PHP via la méthode POST -->
|
|
||||||
<form method="POST">
|
|
||||||
|
|
||||||
<div class="row g-3">
|
|
||||||
|
|
||||||
<!-- Champ : prénom de l'utilisateur -->
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label class="form-label" for="user_firstname">
|
|
||||||
Prénom *
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
class="form-control"
|
|
||||||
type="text"
|
|
||||||
id="user_firstname"
|
|
||||||
name="user_firstname"
|
|
||||||
required >
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Champ : nom de l'utilisateur -->
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label class="form-label" for="user_name">
|
|
||||||
Nom *
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
class="form-control"
|
|
||||||
type="text"
|
|
||||||
id="user_name"
|
|
||||||
name="user_name"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Champ : pseudo -->
|
|
||||||
<div class="col-12">
|
|
||||||
<label class="form-label" for="user_pseudo">
|
|
||||||
Pseudo *
|
|
||||||
</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<span class="input-group-text">@</span>
|
|
||||||
<input
|
|
||||||
class="form-control"
|
|
||||||
type="text"
|
|
||||||
id="user_pseudo"
|
|
||||||
name="user_pseudo"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Champ : adresse e-mail -->
|
|
||||||
<div class="col-12">
|
|
||||||
<label class="form-label" for="user_mail">
|
|
||||||
Adresse e-mail *
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
class="form-control"
|
|
||||||
type="email"
|
|
||||||
id="user_mail"
|
|
||||||
name="user_mail"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Champ : mot de passe -->
|
|
||||||
<div class="col-12">
|
|
||||||
<label class="form-label" for="user_password">
|
|
||||||
Mot de passe *
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
class="form-control"
|
|
||||||
type="password"
|
|
||||||
id="user_password"
|
|
||||||
name="user_password"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<!-- Champ : confirmer le mot de passe -->
|
|
||||||
<div class="col-12">
|
|
||||||
<label class="form-label" for="pwd_confirm">
|
|
||||||
Confirmer le Mot de passe *
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
class="form-control"
|
|
||||||
type="password"
|
|
||||||
id="pwd_confirm"
|
|
||||||
name="pwd_confirm"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Champ optionnel : numéro de téléphone -->
|
|
||||||
<div class="col-12">
|
|
||||||
<label class="form-label" for="user_phone">
|
|
||||||
Téléphone
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
class="form-control"
|
|
||||||
type="text"
|
|
||||||
id="user_phone"
|
|
||||||
name="user_phone"
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Champ optionnel : profession de l'utilisateur -->
|
|
||||||
<div class="col-12">
|
|
||||||
<label class="form-label" for="user_work">
|
|
||||||
Profession
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
class="form-control"
|
|
||||||
type="text"
|
|
||||||
id="user_work"
|
|
||||||
name="user_work"
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Champ optionnel : localisation de l'utilisateur -->
|
|
||||||
<div class="col-12">
|
|
||||||
<label class="form-label" for="user_location">
|
|
||||||
Localisation
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
class="form-control"
|
|
||||||
type="text"
|
|
||||||
id="user_location"
|
|
||||||
name="user_location"
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Champ optionnel : phrase d'accroche -->
|
|
||||||
<div class="col-12">
|
|
||||||
<label class="form-label" for="user_description">
|
|
||||||
Phrase d'accroche
|
|
||||||
</label>
|
|
||||||
<textarea
|
|
||||||
class="form-control"
|
|
||||||
id="user_description"
|
|
||||||
name="user_description"
|
|
||||||
rows="3"
|
|
||||||
></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Bouton de soumission du formulaire -->
|
|
||||||
<div class="col-12 d-grid mt-2">
|
|
||||||
<button type="submit" class="btn btn-primary btn-lg rounded-3">
|
|
||||||
Créer mon compte
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Lien vers la page de connexion -->
|
|
||||||
<div class="col-12 text-center">
|
|
||||||
<small class="text-secondary">
|
|
||||||
Déjà un compte ?
|
|
||||||
<a href="index.php?ctrl=user&action=login">Se connecter</a>
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
{/block}
|
|
||||||
|
|
@ -1,42 +1,28 @@
|
||||||
{extends file="views/layout.tpl"}
|
{extends file="views/layout.tpl"}
|
||||||
|
{block name="title" append} - Connexion{/block}
|
||||||
|
|
||||||
{block name="content"}
|
{block name="content"}
|
||||||
<section aria-label="Se connecter">
|
<section aria-label="Se connecter">
|
||||||
{* Affichage des erreurs *}
|
|
||||||
{if $arrError|count > 0}
|
|
||||||
<div class="alert alert-danger">
|
|
||||||
{foreach from=$arrError item=strError}
|
|
||||||
<p>{$strError}</p>
|
|
||||||
{/foreach}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<!-- Contenu principal de la page -->
|
|
||||||
<main class="container py-5">
|
|
||||||
|
|
||||||
<!-- Centrage horizontal du formulaire -->
|
<div class="py-5">
|
||||||
<div class="row justify-content-center">
|
<!-- Centrage horizontal du formulaire -->
|
||||||
<!-- Contenu principal de la page -->
|
<div class="row justify-content-center">
|
||||||
<main class="container py-5">
|
|
||||||
|
|
||||||
<!-- Centrage horizontal du formulaire -->
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-12 col-md-8 col-lg-5">
|
<div class="col-12 col-md-8 col-lg-5">
|
||||||
|
|
||||||
<!-- Carte contenant le formulaire de connexion -->
|
<!-- Carte contenant le formulaire de connexion -->
|
||||||
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
|
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
|
||||||
|
|
||||||
<!-- Titre principal -->
|
<!-- Titre principal -->
|
||||||
<h1 class="h3 fw-bold mb-1">Connexion</h1>
|
<h1 class="h3 fw-bold mb-1">Connexion</h1>
|
||||||
|
|
||||||
<!-- Texte descriptif -->
|
<!-- Texte descriptif -->
|
||||||
<p class="text-secondary mb-4">
|
<p class="text-secondary mb-4">
|
||||||
Connectez-vous à votre compte.
|
Connectez-vous à votre compte.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<!-- Formulaire de connexion -->
|
<!-- Formulaire de connexion -->
|
||||||
<!-- Le traitement sera effectué en PHP via la méthode POST -->
|
<!-- Le traitement sera effectué en PHP via la méthode POST -->
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
|
|
||||||
<!-- Champ : adresse e-mail de l'utilisateur -->
|
<!-- Champ : adresse e-mail de l'utilisateur -->
|
||||||
|
|
@ -47,11 +33,10 @@
|
||||||
<input
|
<input
|
||||||
value="{$strMail|default:''}"
|
value="{$strMail|default:''}"
|
||||||
type="email"
|
type="email"
|
||||||
class="form-control {if isset($arrError.mail)}is-invalid{/if}"
|
class="form-control {if isset($arrError.user_mail)}is-invalid{/if}"
|
||||||
id="user_mail"
|
id="user_mail"
|
||||||
name="user_mail"
|
name="user_mail"
|
||||||
required
|
required
|
||||||
|
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -62,24 +47,13 @@
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
class="form-control {if isset($arrError.pwd)}is-invalid{/if}"
|
class="form-control {if isset($arrError.user_password)}is-invalid{/if}"
|
||||||
id="user_password"
|
id="user_password"
|
||||||
name="user_password"
|
name="user_password"
|
||||||
required
|
required
|
||||||
|
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Option "Se souvenir de moi" (fonctionnalité optionnelle côté PHP) -->
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" id="remember_me" name="remember_me">
|
|
||||||
<label class="form-check-label" for="remember_me">
|
|
||||||
Se souvenir de moi
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Bouton de soumission du formulaire -->
|
<!-- Bouton de soumission du formulaire -->
|
||||||
<div class="col-12 d-grid mt-2">
|
<div class="col-12 d-grid mt-2">
|
||||||
<button type="submit" class="btn btn-primary btn-lg rounded-3">
|
<button type="submit" class="btn btn-primary btn-lg rounded-3">
|
||||||
|
|
@ -91,15 +65,8 @@
|
||||||
<div class="col-12 text-center">
|
<div class="col-12 text-center">
|
||||||
<small class="text-secondary">
|
<small class="text-secondary">
|
||||||
Pas encore de compte ?
|
Pas encore de compte ?
|
||||||
<a href="index.php?ctrl=user&action=signin" class="link-primary">Créer un compte</a>
|
<a href="index.php?ctrl=user&action=signup" class="link-primary">
|
||||||
</small>
|
Créer un compte
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Lien pour la récupération du mot de passe -->
|
|
||||||
<div class="col-12 text-center">
|
|
||||||
<small>
|
|
||||||
<a href="#" class="link-primary">
|
|
||||||
Mot de passe oublié ?
|
|
||||||
</a>
|
</a>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -110,7 +77,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{extends file="views/layout.tpl"}
|
{extends file="views/layout.tpl"}
|
||||||
|
|
||||||
{block name="title" append}Mentions légales{/block}
|
{block name="title" append} - Mentions légales{/block}
|
||||||
|
|
||||||
{block name="h2"}Mentions légales{/block}
|
{block name="h2"}Mentions légales{/block}
|
||||||
{block name="p"}Informations légales et politique de confidentialité{/block}
|
{block name="p"}Informations légales et politique de confidentialité{/block}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,118 +1,96 @@
|
||||||
{extends file="views/layout.tpl"}
|
{extends file="views/layout.tpl"}
|
||||||
|
{block name="title" append} - Portfolio{/block}
|
||||||
|
|
||||||
{block name="content"}
|
{block name="content"}
|
||||||
<main class="container mt-5 py-5">
|
<div class="mt-5">
|
||||||
|
|
||||||
<!-- Message après l'envoi d'email -->
|
<!-- Message après l'envoi d'email -->
|
||||||
{if isset($smarty.get.mail) && $smarty.get.mail === 'ok'}
|
{if isset($smarty.get.mail) && $smarty.get.mail === 'ok'}
|
||||||
<div class="alert alert-success">Email envoyé avec succès.</div>
|
<div class="alert alert-success">Email envoyé avec succès.</div>
|
||||||
{elseif isset($smarty.get.mail) && $smarty.get.mail === 'fail'}
|
{elseif isset($smarty.get.mail) && $smarty.get.mail === 'fail'}
|
||||||
<div class="alert alert-danger">Erreur lors de l'envoi de l'email.</div>
|
<div class="alert alert-danger">Erreur lors de l'envoi de l'email.</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="row g-4">
|
<div class="row g-4">
|
||||||
|
|
||||||
<!-- Contenu principal du projet -->
|
<!-- Contenu principal du projet -->
|
||||||
<div class="col-lg-8">
|
<div class="col-lg-8">
|
||||||
|
|
||||||
<h1 class="fw-bold">{$objProject->getTitle()}</h1>
|
<h1 class="fw-bold">{$objProject->getTitle()}</h1>
|
||||||
|
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
{$arrProject.category_name ?? 'Général'}
|
{$arrProject.category_name ?? 'Général'}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="mb-4 shadow-sm">
|
<div class="mb-4 shadow-sm">
|
||||||
<img src="{$smarty.env.IMG_PROJECT_PATH}{$objProject->getThumbnail()}"
|
<img
|
||||||
class="img-fluid rounded w-100">
|
src="{$smarty.env.IMG_PROJECT_PATH}{$objProject->getThumbnail()}"
|
||||||
</div>
|
class="img-fluid rounded w-100"
|
||||||
|
alt="Aperçu du projet"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="bg-light p-4 rounded mb-4">
|
<div class="bg-light p-4 rounded mb-4">
|
||||||
<h4 class="border-bottom pb-2">Description</h4>
|
<h4 class="border-bottom pb-2">Description</h4>
|
||||||
<p class="lead">{$objProject->getDescription()}</p>
|
<p class="lead">{$objProject->getDescription()}</p>
|
||||||
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
{$objProject->getContent()}
|
{$objProject->getContent()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Formulaire qui envoie la demande au contrôleur (shareProject) -->
|
||||||
|
<div class="card shadow-sm p-4 mb-5">
|
||||||
|
<form method="post" action="index.php?ctrl=project&action=shareProject">
|
||||||
|
|
||||||
<!-- Images du projet -->
|
<input
|
||||||
<section id="galerie-projet">
|
type="hidden"
|
||||||
<h2>Galerie du projet</h2>
|
name="project_id"
|
||||||
<div class="row">
|
value="{$objProject->getId()}"
|
||||||
{foreach $arrImages as $image}
|
>
|
||||||
|
|
||||||
{* On affiche l'image si elle est approuvée OU si l'utlilisateur possède le projet OU si l'utlilisateur est Modérateur*}
|
<input
|
||||||
{if ($image.image_status == 'approuvé') ||
|
type="email"
|
||||||
(isset($smarty.session.user) && $smarty.session.user.user_status == 2) ||
|
name="to_email"
|
||||||
(isset($smarty.session.user) && $smarty.session.user.user_id == $objProject->getUser_id())}
|
class="form-control mb-3"
|
||||||
|
placeholder="Adresse email"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
|
||||||
<div class="col-md-4 mb-4">
|
<button type="submit" class="btn btn-primary w-100">
|
||||||
<div class="card {if $image.image_status != 'approuvé'}border-warning shadow-none opacity-75{/if}">
|
Envoyer par email
|
||||||
|
</button>
|
||||||
|
|
||||||
<img src="{$smarty.env.IMG_PROJECT_PATH}{$image.image_name}" class="card-img-top" alt="{$image.image_alt}">
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
{* Visible uniquement par le modérateur *}
|
</div>
|
||||||
{if isset($smarty.session.user.user_status) && $smarty.session.user.user_status == 2}
|
|
||||||
<div class="moderator-tools border-top pt-2 mt-2">
|
|
||||||
<div class="d-flex gap-2">
|
|
||||||
<a href="index.php?ctrl=project&action=change_image_status&id_img={$image.image_id}&status=approuvé"
|
|
||||||
class="btn btn-sm btn-success">Valider</a>
|
|
||||||
|
|
||||||
<a href="index.php?ctrl=project&action=delete_image&id_img={$image.image_id}"
|
<!-- Sidebar : informations du créateur -->
|
||||||
class="btn btn-sm btn-outline-danger"
|
<div class="col-lg-4">
|
||||||
onclick="return confirm('Supprimer définitivement ?')">Supprimer</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{foreachelse}
|
|
||||||
<p>Aucune image disponible pour ce projet.</p>
|
|
||||||
{/foreach}
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
<div class="card text-center shadow-sm p-4">
|
||||||
|
<a
|
||||||
|
href="index.php?ctrl=user&action=user&id={$objProject->getUser_id()}"
|
||||||
|
class="text-decoration-none text-dark"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="{$smarty.env.IMG_USER_PATH}{$objProject->getUser_image()|default:'images.jpg'}"
|
||||||
|
class="rounded-circle mb-3 mx-auto"
|
||||||
|
style="width:100px;height:100px;object-fit:cover;"
|
||||||
|
alt="Photo du créateur"
|
||||||
|
>
|
||||||
|
</a>
|
||||||
|
|
||||||
<!-- Formulaire qui envoie la demande au contrôleur (shareProject) -->
|
<h5>{$objProject->getCreatorName()}</h5>
|
||||||
<div class="card shadow-sm p-4 mb-5">
|
|
||||||
<form method="post" action="index.php?ctrl=project&action=shareProject">
|
|
||||||
|
|
||||||
<input type="hidden" name="project_id"
|
<p class="text-muted small">
|
||||||
value="{$objProject->getId()}">
|
Publié le {$objProject->getCreation_date()}
|
||||||
|
</p>
|
||||||
|
|
||||||
<input type="email" name="to_email"
|
<button class="btn btn-primary">Contacter le talent</button>
|
||||||
class="form-control mb-3"
|
</div>
|
||||||
placeholder="Adresse email" required>
|
{*Controle de l'utilisateur ainsi que du status du projet + Suppression disponible pour l'utilisateur possédant le projet*}
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary w-100">
|
|
||||||
Envoyer par email
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Sidebar : informations du créateur -->
|
|
||||||
<div class="col-lg-4">
|
|
||||||
<div class="card text-center shadow-sm p-4">
|
|
||||||
<a href="index.php?ctrl=user&action=user&pseudo={$objProject->getCreatorname()}" class="text-decoration-none text-dark">
|
|
||||||
<img src="{$smarty.env.IMG_USER_PATH}{$objProject->getUser_image() ?? "images.jpg"}"
|
|
||||||
class="rounded-circle mb-3 mx-auto"
|
|
||||||
style="width:100px;height:100px;object-fit:cover;">
|
|
||||||
</a>
|
|
||||||
<h5>{$objProject->getCreatorName()}</h5>
|
|
||||||
|
|
||||||
<p class="text-muted small">
|
|
||||||
Publié le {$objProject->getCreation_date()}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<button class="btn btn-primary">Contacter le talent</button>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{*Controle de l'utilisateur ainsi que du status du projet + Suppression disponible pour l'utilisateur possédant le projet*}
|
|
||||||
{if isset($smarty.session.user)}
|
{if isset($smarty.session.user)}
|
||||||
{if ($smarty.session.user.user_status == 2 || $smarty.session.user.user_id == $objProject->getUser_id())}
|
{if ($smarty.session.user.user_status == 2 || $smarty.session.user.user_id == $objProject->getUser_id())}
|
||||||
<div class="border rounded text-center">
|
<div class="border rounded text-center">
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{extends file="views/layout.tpl"}
|
{extends file="views/layout.tpl"}
|
||||||
|
{block name="title" append} - Rechercher{/block}
|
||||||
|
|
||||||
{block name="content"}
|
{block name="content"}
|
||||||
<section aria-label="Blog">
|
<section aria-label="Blog">
|
||||||
|
|
|
||||||
202
views/signup.tpl
Normal file
202
views/signup.tpl
Normal file
|
|
@ -0,0 +1,202 @@
|
||||||
|
{extends file="views/layout.tpl"}
|
||||||
|
{block name="title" append} - Inscription{/block}
|
||||||
|
|
||||||
|
{block name="content"}
|
||||||
|
<!-- Page : Inscription -->
|
||||||
|
|
||||||
|
<div class="py-5">
|
||||||
|
|
||||||
|
<!-- Centrage horizontal du formulaire -->
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-12 col-md-10 col-lg-6">
|
||||||
|
|
||||||
|
<!-- Carte contenant le formulaire d'inscription -->
|
||||||
|
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
|
||||||
|
|
||||||
|
<!-- Titre principal de la page -->
|
||||||
|
<h1 class="h3 fw-bold mb-1">Inscription</h1>
|
||||||
|
|
||||||
|
<!-- Texte descriptif -->
|
||||||
|
<p class="text-secondary mb-4">
|
||||||
|
Créez votre compte utilisateur.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- Formulaire d'inscription -->
|
||||||
|
<!-- Les données seront traitées côté serveur en PHP via la méthode POST -->
|
||||||
|
<form method="POST">
|
||||||
|
<div class="row g-3">
|
||||||
|
|
||||||
|
<!-- Champ : prénom de l'utilisateur -->
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label" for="user_firstname">
|
||||||
|
Prénom *
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="text"
|
||||||
|
id="user_firstname"
|
||||||
|
name="user_firstname"
|
||||||
|
value="{$objUser->getFirstname()|default:''}"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ : nom de l'utilisateur -->
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label" for="user_name">
|
||||||
|
Nom *
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="text"
|
||||||
|
id="user_name"
|
||||||
|
name="user_name"
|
||||||
|
value="{$objUser->getName()|default:''}"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ : pseudo -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_pseudo">
|
||||||
|
Pseudo *
|
||||||
|
</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-text">@</span>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="text"
|
||||||
|
id="user_pseudo"
|
||||||
|
name="user_pseudo"
|
||||||
|
value="{$objUser->getPseudo()|default:''}"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ : adresse e-mail -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_mail">
|
||||||
|
Adresse e-mail *
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="email"
|
||||||
|
id="user_mail"
|
||||||
|
name="user_mail"
|
||||||
|
value="{$objUser->getMail()|default:''}"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ : mot de passe -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_password">
|
||||||
|
Mot de passe *
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="password"
|
||||||
|
id="user_password"
|
||||||
|
name="user_password"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ : confirmer le mot de passe -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="pwd_confirm">
|
||||||
|
Confirmer le mot de passe *
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="password"
|
||||||
|
id="pwd_confirm"
|
||||||
|
name="pwd_confirm"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ optionnel : numéro de téléphone -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_phone">
|
||||||
|
Téléphone
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="text"
|
||||||
|
id="user_phone"
|
||||||
|
name="user_phone"
|
||||||
|
value="{$objUser->getPhone()|default:''}"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ optionnel : profession de l'utilisateur -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_work">
|
||||||
|
Profession
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="text"
|
||||||
|
id="user_work"
|
||||||
|
name="user_work"
|
||||||
|
value="{$objUser->getWork()|default:''}"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ optionnel : localisation de l'utilisateur -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_location">
|
||||||
|
Localisation
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="text"
|
||||||
|
id="user_location"
|
||||||
|
name="user_location"
|
||||||
|
value="{$objUser->getLocation()|default:''}"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ optionnel : phrase d'accroche -->
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label" for="user_description">
|
||||||
|
Phrase d'accroche
|
||||||
|
</label>
|
||||||
|
<textarea
|
||||||
|
class="form-control"
|
||||||
|
id="user_description"
|
||||||
|
name="user_description"
|
||||||
|
value="{$objUser->getDescription()|default:''}"
|
||||||
|
rows="3"
|
||||||
|
></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Bouton de soumission du formulaire -->
|
||||||
|
<div class="col-12 d-grid mt-2">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg rounded-3">
|
||||||
|
Créer mon compte
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Lien vers la page de connexion -->
|
||||||
|
<div class="col-12 text-center">
|
||||||
|
<small class="text-secondary">
|
||||||
|
Déjà un compte ?
|
||||||
|
<a class="link-primary" href="index.php?ctrl=user&action=login">
|
||||||
|
Se connecter
|
||||||
|
</a>
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue