tout cassé (ㆆ_ㆆ)
This commit is contained in:
parent
b11f67793a
commit
26c81bc3c6
8 changed files with 50 additions and 35 deletions
|
|
@ -212,17 +212,23 @@ class UserCtrl extends MotherCtrl {
|
|||
|
||||
$arrError['user_mail'] = "Ce mail est déjà associé";
|
||||
} else {
|
||||
$objUser->hydrate($_POST);
|
||||
$objUser->setId($_SESSION['user']['user_id']);
|
||||
$boolInsert = $objUserModel->update($objUser);
|
||||
if ($objUserModel->pseudoExists($objUser->getPseudo()) && ($_POST['user_pseudo'] != $objUser->getPseudo())){
|
||||
$arrError['user_pseudo'] = "Ce pseudo est déjà utiliser";
|
||||
}else{
|
||||
$boolInsert = $objUserModel->update($objUser);
|
||||
|
||||
if ($boolInsert === true) {
|
||||
$_SESSION['success'] = "Compte créé avec succès";
|
||||
header("Location:?ctrl=user&action=user&id=".$objUser->getId());
|
||||
exit;
|
||||
} else {
|
||||
$arrError['global'] = "Erreur lors de l'update";
|
||||
}
|
||||
if ($boolInsert === true) {
|
||||
$objUser->hydrate($_POST);
|
||||
$objUser->setPseudo($_SESSION['user']['user_pseudo']);
|
||||
$arrNewInfo = $objUserModel->findUserByPseudo($objUser->getPseudo());
|
||||
$objUser->hydrate($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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
* @return array
|
||||
*/
|
||||
public function findAllUsers():array{
|
||||
$strRq = "SELECT user_id, user_firstname, user_name, user_image, user_status, authorisation_name
|
||||
$strRq = "SELECT user_id, user_firstname, user_name, user_image, user_status, authorisation_name, user_pseudo
|
||||
FROM users INNER JOIN authorisation ON authorisation.authorisation_id = users.user_status
|
||||
WHERE user_deleted_at IS NULL";
|
||||
return $this->_db->query($strRq)->fetchAll();
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
public function verifUser(string $strMail, string $strPwd):array|bool{
|
||||
|
||||
$strRq = "SELECT user_id, user_name, user_firstname, user_password, user_image, user_status, authorisation_name
|
||||
$strRq = "SELECT user_id, user_name, user_firstname, user_password, user_image, user_status, authorisation_name, user_pseudo
|
||||
FROM users INNER JOIN authorisation ON authorisation.authorisation_id = users.user_status
|
||||
WHERE user_mail = '".$strMail."'";
|
||||
|
||||
|
|
@ -154,7 +154,7 @@
|
|||
*/
|
||||
public function findUserById(int $intId): array|bool {
|
||||
|
||||
$strRq = "SELECT * FROM users WHERE user_id = :id";
|
||||
$strRq = "SELECT user_name, user_firstname, user_pseudo, user_mail, user_password, user_phone, user_work, user_location, user_description FROM users WHERE user_id = :id";
|
||||
|
||||
$prep = $this->_db->prepare($strRq);
|
||||
$prep->bindValue(':id', $intId, PDO::PARAM_INT);
|
||||
|
|
@ -173,4 +173,13 @@
|
|||
|
||||
return $prep->fetch();
|
||||
}
|
||||
|
||||
public function pseudoExists(string $pseudo): bool{
|
||||
|
||||
$rq = $this->_db->prepare("SELECT 1 FROM users WHERE user_pseudo = :pseudo LIMIT 1");
|
||||
$rq->bindValue(":pseudo", $pseudo, PDO::PARAM_STR);
|
||||
$rq->execute();
|
||||
|
||||
return (bool)$rq->fetchColumn();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/* Smarty version 5.7.0, created on 2026-02-19 20:09:19
|
||||
/* Smarty version 5.7.0, created on 2026-02-19 20:34:58
|
||||
from 'file:views/home.tpl' */
|
||||
|
||||
/* @var \Smarty\Template $_smarty_tpl */
|
||||
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||
'version' => '5.7.0',
|
||||
'unifunc' => 'content_69976def59c414_70095814',
|
||||
'unifunc' => 'content_699773f2d00b20_63958967',
|
||||
'has_nocache_code' => false,
|
||||
'file_dependency' =>
|
||||
array (
|
||||
|
|
@ -21,20 +21,20 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
|||
'file:views/_partial/preview.tpl' => 1,
|
||||
),
|
||||
))) {
|
||||
function content_69976def59c414_70095814 (\Smarty\Template $_smarty_tpl) {
|
||||
function content_699773f2d00b20_63958967 (\Smarty\Template $_smarty_tpl) {
|
||||
$_smarty_current_dir = 'D:\\projetphp\\views';
|
||||
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_133394531269976def598252_85195320', "content");
|
||||
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1754256969699773f2cfc9e0_97315296', "content");
|
||||
?>
|
||||
|
||||
<?php $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
|
||||
}
|
||||
/* {block "content"} */
|
||||
class Block_133394531269976def598252_85195320 extends \Smarty\Runtime\Block
|
||||
class Block_1754256969699773f2cfc9e0_97315296 extends \Smarty\Runtime\Block
|
||||
{
|
||||
public function callBlock(\Smarty\Template $_smarty_tpl) {
|
||||
$_smarty_current_dir = 'D:\\projetphp\\views';
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/* Smarty version 5.7.0, created on 2026-02-19 20:09:48
|
||||
/* Smarty version 5.7.0, created on 2026-02-19 20:34:58
|
||||
from 'file:views/layout.tpl' */
|
||||
|
||||
/* @var \Smarty\Template $_smarty_tpl */
|
||||
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||
'version' => '5.7.0',
|
||||
'unifunc' => 'content_69976e0ca03d67_47539078',
|
||||
'unifunc' => 'content_699773f2daec37_53772832',
|
||||
'has_nocache_code' => false,
|
||||
'file_dependency' =>
|
||||
array (
|
||||
|
|
@ -22,21 +22,21 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
|||
'file:views/_partial/footer.tpl' => 1,
|
||||
),
|
||||
))) {
|
||||
function content_69976e0ca03d67_47539078 (\Smarty\Template $_smarty_tpl) {
|
||||
function content_699773f2daec37_53772832 (\Smarty\Template $_smarty_tpl) {
|
||||
$_smarty_current_dir = 'D:\\projetphp\\views';
|
||||
$_smarty_tpl->getInheritance()->init($_smarty_tpl, false);
|
||||
$_smarty_tpl->renderSubTemplate("file:views/_partial/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_27929295869976e0ca01fb9_36548139', "content");
|
||||
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1261446363699773f2dad438_86277148', "content");
|
||||
?>
|
||||
|
||||
|
||||
<?php $_smarty_tpl->renderSubTemplate("file:views/_partial/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
|
||||
}
|
||||
/* {block "content"} */
|
||||
class Block_27929295869976e0ca01fb9_36548139 extends \Smarty\Runtime\Block
|
||||
class Block_1261446363699773f2dad438_86277148 extends \Smarty\Runtime\Block
|
||||
{
|
||||
public function callBlock(\Smarty\Template $_smarty_tpl) {
|
||||
$_smarty_current_dir = 'D:\\projetphp\\views';
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/* Smarty version 5.7.0, created on 2026-02-19 20:09:48
|
||||
/* Smarty version 5.7.0, created on 2026-02-19 20:34:59
|
||||
from 'file:views/_partial/footer.tpl' */
|
||||
|
||||
/* @var \Smarty\Template $_smarty_tpl */
|
||||
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||
'version' => '5.7.0',
|
||||
'unifunc' => 'content_69976e0cbdbc02_44067705',
|
||||
'unifunc' => 'content_699773f31603e6_74741526',
|
||||
'has_nocache_code' => false,
|
||||
'file_dependency' =>
|
||||
array (
|
||||
|
|
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
|||
array (
|
||||
),
|
||||
))) {
|
||||
function content_69976e0cbdbc02_44067705 (\Smarty\Template $_smarty_tpl) {
|
||||
function content_699773f31603e6_74741526 (\Smarty\Template $_smarty_tpl) {
|
||||
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
|
||||
?>
|
||||
<footer class="footer container-fluid d-flex justify-content-around mt-auto">
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/* Smarty version 5.7.0, created on 2026-02-19 20:09:26
|
||||
/* Smarty version 5.7.0, created on 2026-02-19 20:34:59
|
||||
from 'file:views/_partial/preview.tpl' */
|
||||
|
||||
/* @var \Smarty\Template $_smarty_tpl */
|
||||
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||
'version' => '5.7.0',
|
||||
'unifunc' => 'content_69976df6e78664_25243843',
|
||||
'unifunc' => 'content_699773f30290e1_79139964',
|
||||
'has_nocache_code' => false,
|
||||
'file_dependency' =>
|
||||
array (
|
||||
|
|
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
|||
array (
|
||||
),
|
||||
))) {
|
||||
function content_69976df6e78664_25243843 (\Smarty\Template $_smarty_tpl) {
|
||||
function content_699773f30290e1_79139964 (\Smarty\Template $_smarty_tpl) {
|
||||
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
|
||||
?><article class="col-md-3 mb-5 <?php if ((true && (true && null !== ($_SESSION['user'] ?? null))) && $_SESSION['user']['user_status'] == 2) {?> pb-5 <?php }?>" style="border-radius: 100px ;">
|
||||
<div class="card h-100 shadow article-card rounded-4" style="border-width: 2px; overflow: hidden;">
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
<?php
|
||||
/* Smarty version 5.7.0, created on 2026-02-19 20:09:48
|
||||
/* Smarty version 5.7.0, created on 2026-02-19 20:34:58
|
||||
from 'file:views/_partial/header.tpl' */
|
||||
|
||||
/* @var \Smarty\Template $_smarty_tpl */
|
||||
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||
'version' => '5.7.0',
|
||||
'unifunc' => 'content_69976e0ca81001_88880615',
|
||||
'unifunc' => 'content_699773f2e1fb23_50571046',
|
||||
'has_nocache_code' => false,
|
||||
'file_dependency' =>
|
||||
array (
|
||||
'8056b95e7f6b28be5e36947735d13c8d176ec944' =>
|
||||
array (
|
||||
0 => 'views/_partial/header.tpl',
|
||||
1 => 1771529669,
|
||||
1 => 1771532429,
|
||||
2 => 'file',
|
||||
),
|
||||
),
|
||||
|
|
@ -21,7 +21,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
|||
'file:views/_partial/messages.tpl' => 1,
|
||||
),
|
||||
))) {
|
||||
function content_69976e0ca81001_88880615 (\Smarty\Template $_smarty_tpl) {
|
||||
function content_699773f2e1fb23_50571046 (\Smarty\Template $_smarty_tpl) {
|
||||
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
|
||||
?><!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
|
@ -86,7 +86,7 @@ $_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
|
|||
<?php } else { ?>
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="index.php?ctrl=user&action=user&id=<?php echo $_SESSION['user']['user_id'];?>
|
||||
<a class="nav-link" href="index.php?ctrl=user&action=user&pseudo=<?php echo $_SESSION['user']['user_pseudo'];?>
|
||||
" title="Modifier mon compte" aria-label="Modifier mon compte">
|
||||
<img src="<?php echo $_SESSION['user']['user_image'];?>
|
||||
"
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
{* Utilisateur connecté *}
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="index.php?ctrl=user&action=user&id={$smarty.session.user.user_id}" title="Modifier mon compte" aria-label="Modifier mon compte">
|
||||
<a class="nav-link" href="index.php?ctrl=user&action=user&pseudo={$smarty.session.user.user_pseudo}" title="Modifier mon compte" aria-label="Modifier mon compte">
|
||||
<img src="{$smarty.session.user.user_image}"
|
||||
class="rounded-circle flex-shrink-0 mt-2 ml-5"
|
||||
style="width: 36px; height: 36px; object-fit: cover;"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue