Mise à jour du CSS d'affichage de shipmember.php, administration.php et bateaux.php pour les pages de connexion et pour les pages d'affectation de droits su run bateau
This commit is contained in:
@@ -394,3 +394,31 @@ echo '</html>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//************************************************************************************************************
|
||||
// Jeton anti-CSRF (synthèse §48) : un jeton aléatoire par session, inclus dans chaque formulaire et vérifié à chaque
|
||||
// requête POST - un formulaire envoyé depuis un autre site ne peut pas le connaître. Complète SameSite=Lax.
|
||||
//************************************************************************************************************
|
||||
|
||||
// Fonction : Jeton de la session (créé au premier appel).
|
||||
// Retour : Le jeton (64 caractères hexadécimaux)
|
||||
function Jeton_csrf()
|
||||
{
|
||||
if (empty($_SESSION['jeton_csrf'])) $_SESSION['jeton_csrf'] = bin2hex(random_bytes(32));
|
||||
return $_SESSION['jeton_csrf'];
|
||||
}
|
||||
|
||||
// Fonction : Champ caché portant le jeton, à placer dans chaque formulaire POST.
|
||||
// Retour : Le code HTML du champ
|
||||
function Champ_jeton_csrf()
|
||||
{
|
||||
return '<input type="hidden" name="jeton_csrf" value="'.Jeton_csrf().'">';
|
||||
}
|
||||
|
||||
// Fonction : Vérifie le jeton reçu dans la requête POST (comparaison à temps constant).
|
||||
// Retour : true si le jeton est présent et correct
|
||||
function Jeton_csrf_valide()
|
||||
{
|
||||
return (isset($_POST['jeton_csrf']) && is_string($_POST['jeton_csrf']) && hash_equals(Jeton_csrf(), $_POST['jeton_csrf']));
|
||||
}
|
||||
|
||||
+188
-141
@@ -37,6 +37,42 @@ Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session
|
||||
if (!isset($_SESSION['Bateaux']['bateau']['Commentaires'])) $_SESSION['Bateaux']['bateau']['Commentaires'] = "";
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Contrôles PRÉALABLES à toute action (synthèse §48) - auparavant, les actions GET et POST s'exécutaient avant tout
|
||||
// contrôle : n'importe quel utilisateur connecté pouvait créer, modifier ou dévalider un bateau.
|
||||
//---------------------------------------------------------------------------
|
||||
if (!$_SESSION['acces_valide'])
|
||||
{
|
||||
Fermeture_bdd();
|
||||
header('Location:shipmembers.php?action=navigation&destination=Login');
|
||||
exit();
|
||||
}
|
||||
$est_administrateur = ($_SESSION['shipmember']['Niveau_acces'] >= NIVEAU_ACCES_MINI_ADMINISTRATEUR);
|
||||
|
||||
// Toute requête POST doit porter le jeton de la session (protection contre les formulaires envoyés depuis un autre site,
|
||||
// en complément de SameSite=Lax) :
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && !Jeton_csrf_valide())
|
||||
{
|
||||
$_SESSION['Bateaux']['flash_erreur'] = t("Formulaire expiré ou invalide : merci de recommencer.");
|
||||
Fermeture_bdd();
|
||||
header('Location: bateaux.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
// Gestion de la flotte (liste, création, modification, dévalidation d'un bateau) : réservée aux administrateurs :
|
||||
$actions_flotte = array('tri_liste', 'creation_bateau', 'modification_bateau', 'demande_suppression_bateau');
|
||||
if (!$est_administrateur &&
|
||||
((isset($_GET['action']) && in_array($_GET['action'], $actions_flotte, true))
|
||||
|| isset($_POST['validation_creation_bateau']) || isset($_POST['validation_modification_bateau'])
|
||||
|| isset($_POST['confirmation_suppression_bateau'])))
|
||||
{
|
||||
$_SESSION['Bateaux']['flash_erreur'] = t("Action réservée aux administrateurs.");
|
||||
Fermeture_bdd();
|
||||
header('Location: bateaux.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// Variables GET :
|
||||
if (isset($_GET['ancre'])) $_SESSION['Bateaux']['ancre'] = $_GET['ancre'];
|
||||
|
||||
@@ -47,7 +83,9 @@ Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session
|
||||
//===================================
|
||||
case "navigation":
|
||||
{
|
||||
if (isset($_GET['destination']))
|
||||
// Seules les pages consultables par simple navigation ; création, modification et suppression passent par leurs
|
||||
// actions dédiées (contrôlées ci-dessus) :
|
||||
if (isset($_GET['destination']) && in_array($_GET['destination'], array('Accueil', 'Details_bateau'), true))
|
||||
{
|
||||
$_SESSION['Bateaux']['page'] = $_GET['destination'];
|
||||
}
|
||||
@@ -95,7 +133,7 @@ Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session
|
||||
{
|
||||
if (isset($_GET['id_bateau']))
|
||||
{
|
||||
$_SESSION['Bateaux']['bateau']['Cle_primaire'] = $_GET['id_bateau'];
|
||||
$_SESSION['Bateaux']['bateau']['Cle_primaire'] = (int)$_GET['id_bateau'];
|
||||
$_SESSION['Bateaux']['type_details_bateau'] = "resume";
|
||||
$_SESSION['Bateaux']['page'] = "Details_bateau";
|
||||
|
||||
@@ -109,7 +147,7 @@ Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session
|
||||
//===================================
|
||||
case "type_details_bateau":
|
||||
{
|
||||
if (isset($_GET['type'])) $_SESSION['Bateaux']['type_details_bateau'] = $_GET['type'];
|
||||
if (isset($_GET['type']) && in_array($_GET['type'], array('resume', 'gerer_les_acces'), true)) $_SESSION['Bateaux']['type_details_bateau'] = $_GET['type'];
|
||||
$_SESSION['Bateaux']['ancre'] = "";
|
||||
break;
|
||||
}
|
||||
@@ -119,8 +157,9 @@ Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session
|
||||
{
|
||||
if (isset($_GET['id_bateau']))
|
||||
{
|
||||
$_SESSION['Bateaux']['bateau']['Cle_primaire'] = $_GET['id_bateau'];
|
||||
$_SESSION['Bateaux']['bateau']['Cle_primaire'] = (int)$_GET['id_bateau'];
|
||||
$_SESSION['Bateaux']['page'] = "Modification_bateau";
|
||||
$_SESSION['Bateaux']['charger_bateau'] = true; // Valeurs lues en base à l'affichage du formulaire
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -129,6 +168,9 @@ Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session
|
||||
case "creation_bateau":
|
||||
{
|
||||
$_SESSION['Bateaux']['page'] = "Creation_bateau";
|
||||
// Formulaire vierge - réinitialisé ICI et non plus à chaque affichage : après une erreur de saisie, le formulaire
|
||||
// réaffiché garde les valeurs saisies :
|
||||
$_SESSION['Bateaux']['bateau'] = array('Cle_primaire' => 0, 'Nom' => "", 'ID_Flotte' => 0, 'Date_mes' => date("Y-m-d"), 'Commentaires' => "");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -137,81 +179,74 @@ Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session
|
||||
{
|
||||
if (isset($_GET['id_bateau']))
|
||||
{
|
||||
$_SESSION['Bateaux']['bateau']['Cle_primaire'] = $_GET['id_bateau'];
|
||||
$_SESSION['Bateaux']['bateau']['Cle_primaire'] = (int)$_GET['id_bateau'];
|
||||
$_SESSION['Bateaux']['page'] = "Confirmation_suppression_bateau";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//===================================
|
||||
case "confirmation_suppression_bateau":
|
||||
{
|
||||
if (isset($_GET['id_bateau']))
|
||||
{
|
||||
$_SESSION['Bateaux']['bateau']['Cle_primaire'] = $_GET['id_bateau'];
|
||||
|
||||
// Suppression du bateau :
|
||||
$requete = 'UPDATE TB_Bateaux SET Validite=0 WHERE Cle_primaire=?';
|
||||
Requete_preparee_bdd($requete,
|
||||
array(
|
||||
array('s', $_SESSION['Bateaux']['bateau']['Cle_primaire'])),
|
||||
__FILE__, __LINE__);
|
||||
|
||||
$flag_redirection = true; // Evite que le message d'erreur soit supprimé par la redirection de purge d'URL
|
||||
|
||||
$message_information = 'Le bateau <span class="gras">'.$_SESSION['Bateaux']['bateau']['Nom'].'</span> a été dévalidé dans la base de données.';
|
||||
|
||||
$_SESSION['Bateaux']['page'] = "Accueil";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// NB : la confirmation de suppression n'est plus une action GET (un simple lien suffisait à dévalider un bateau) :
|
||||
// elle est envoyée en POST, avec le jeton de session (voir plus bas).
|
||||
}
|
||||
|
||||
Fermeture_bdd();
|
||||
if ($_SESSION['Bateaux']['ancre'] == "") header('Location:bateaux.php'); // Permet de "vider" la barre d'URL des champs GET et donc de doubler le traitement en cas de raffraichissement de page...
|
||||
else header('Location:bateaux.php#'.$_SESSION['Bateaux']['ancre'].'');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// Variables POST :
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Création/Modification Bateau :
|
||||
// Création/Modification Bateau (administrateurs - contrôlé plus haut) :
|
||||
// NB : l'affectation d'un module ShipBase à un bateau ne se fait plus ici mais via TB_Affectations_bateaux
|
||||
// (administration de la flotte, lot 4 - synthèse §44.10). Les anciens champs ID_Carte/Date_carte et les
|
||||
// répertoires download/upload/archives du modèle CM4 ont été retirés (synthèse §47).
|
||||
// Valeurs enregistrées TELLES QUELLES (requêtes préparées) : l'ancien addslashes() les stockait avec des barres
|
||||
// obliques (d\'Artagnan), retirées ensuite à l'affichage par stripcslashes() (synthèse §48).
|
||||
if (isset($_POST['validation_creation_bateau']) OR isset($_POST['validation_modification_bateau']))
|
||||
{
|
||||
// Mémorisation des valeurs saisies pour éviter de les perdre en cas d'erreur rendant la création impossible :
|
||||
$_SESSION['Bateaux']['bateau']['Nom'] = isset($_POST['Nom']) ? addslashes ($_POST['Nom']) : "";
|
||||
$_SESSION['Bateaux']['bateau']['ID_Flotte'] = isset($_POST['ID_Flotte']) ? addslashes ($_POST['ID_Flotte']) : 0;
|
||||
$_SESSION['Bateaux']['bateau']['Date_mes'] = isset($_POST['Date_mes']) ? addslashes ($_POST['Date_mes']) : date("Y-m-d");
|
||||
$_SESSION['Bateaux']['bateau']['Commentaires'] = isset($_POST['Commentaires']) ? addslashes ($_POST['Commentaires']) : "";
|
||||
// Mémorisation des valeurs saisies pour les réafficher en cas d'erreur :
|
||||
$_SESSION['Bateaux']['bateau']['Nom'] = trim((string)($_POST['Nom'] ?? ""));
|
||||
$_SESSION['Bateaux']['bateau']['ID_Flotte'] = (int)($_POST['ID_Flotte'] ?? 0);
|
||||
$_SESSION['Bateaux']['bateau']['Date_mes'] = trim((string)($_POST['Date_mes'] ?? ""));
|
||||
$_SESSION['Bateaux']['bateau']['Commentaires'] = (string)($_POST['Commentaires'] ?? "");
|
||||
|
||||
if (isset($_POST['validation_creation_bateau']))
|
||||
// Vérifications :
|
||||
$longueur_nom = mb_strlen($_SESSION['Bateaux']['bateau']['Nom']);
|
||||
if ($longueur_nom < 1 || $longueur_nom > 50) $message_erreur .= t("Le nom du bateau doit comporter de 1 à 50 caractères.")."<br />";
|
||||
$date = date_create_from_format('!Y-m-d', $_SESSION['Bateaux']['bateau']['Date_mes']);
|
||||
if ($date === false || $date->format('Y-m-d') !== $_SESSION['Bateaux']['bateau']['Date_mes']) $message_erreur .= t("Date de mise en service invalide (format AAAA-MM-JJ).")."<br />";
|
||||
if ($_SESSION['Bateaux']['bateau']['ID_Flotte'] != 0)
|
||||
{
|
||||
// Création du bateau :
|
||||
$requete = 'INSERT INTO TB_Bateaux (Nom, ID_Flotte, Date_mes, Commentaires) VALUES (?, ?, ?, ?)';
|
||||
Requete_preparee_bdd($requete,
|
||||
$reponse = Requete_preparee_bdd("SELECT COUNT(*) AS nb FROM TB_Flottes WHERE Cle_primaire=? AND Validite=1",
|
||||
array(array('i', $_SESSION['Bateaux']['bateau']['ID_Flotte'])), __FILE__, __LINE__);
|
||||
$donnees = Recherche_ligne_bdd($reponse);
|
||||
Liberation_jeu_de_resultat_bdd($reponse);
|
||||
if ($donnees['nb'] == 0) $message_erreur .= t("Flotte inconnue.")."<br />";
|
||||
}
|
||||
|
||||
if ($message_erreur == "") // Sinon : le formulaire est réaffiché avec les valeurs saisies et le message d'erreur
|
||||
{
|
||||
if (isset($_POST['validation_creation_bateau']))
|
||||
{
|
||||
$requete = 'INSERT INTO TB_Bateaux (Nom, ID_Flotte, Date_mes, Commentaires) VALUES (?, ?, ?, ?)';
|
||||
Requete_preparee_bdd($requete,
|
||||
array(
|
||||
array('s', $_SESSION['Bateaux']['bateau']['Nom']),
|
||||
array('i', $_SESSION['Bateaux']['bateau']['ID_Flotte']),
|
||||
array('s', $_SESSION['Bateaux']['bateau']['Date_mes']),
|
||||
array('s', $_SESSION['Bateaux']['bateau']['Commentaires'])),
|
||||
__FILE__, __LINE__);
|
||||
|
||||
// Récup de la clé primaire de l'enregistrement créé :
|
||||
$_SESSION['Bateaux']['bateau']['Cle_primaire'] = Recuperation_id_cree_bdd();
|
||||
|
||||
// Retour à la liste si la création s'est bien passée :
|
||||
$_SESSION['Bateaux']['page'] = "Accueil";
|
||||
}
|
||||
else if (isset($_POST['validation_modification_bateau']))
|
||||
{
|
||||
// Mise à jour du bateau :
|
||||
$requete = 'UPDATE TB_Bateaux SET Nom=?, ID_Flotte=?, Date_mes=?, Commentaires=? WHERE Cle_primaire=?';
|
||||
Requete_preparee_bdd($requete,
|
||||
$_SESSION['Bateaux']['bateau']['Cle_primaire'] = Recuperation_id_cree_bdd();
|
||||
$_SESSION['Bateaux']['flash_information'] = str_replace("[[Nom]]", htmlspecialchars($_SESSION['Bateaux']['bateau']['Nom']), t("Le bateau [[Nom]] vient d'être créé."));
|
||||
}
|
||||
else
|
||||
{
|
||||
$requete = 'UPDATE TB_Bateaux SET Nom=?, ID_Flotte=?, Date_mes=?, Commentaires=? WHERE Cle_primaire=? AND Validite=1';
|
||||
Requete_preparee_bdd($requete,
|
||||
array(
|
||||
array('s', $_SESSION['Bateaux']['bateau']['Nom']),
|
||||
array('i', $_SESSION['Bateaux']['bateau']['ID_Flotte']),
|
||||
@@ -219,15 +254,30 @@ Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session
|
||||
array('s', $_SESSION['Bateaux']['bateau']['Commentaires']),
|
||||
array('i', $_SESSION['Bateaux']['bateau']['Cle_primaire'])),
|
||||
__FILE__, __LINE__);
|
||||
|
||||
// Message d'information :
|
||||
$message_information = 'Le bateau <span class="gras">'.$_SESSION['Bateaux']['bateau']['Nom'].'</span> vient d\'être modifié';
|
||||
|
||||
// Retour à la liste si la modification s'est bien passée :
|
||||
$_SESSION['Bateaux']['flash_information'] = str_replace("[[Nom]]", htmlspecialchars($_SESSION['Bateaux']['bateau']['Nom']), t("Le bateau [[Nom]] vient d'être modifié."));
|
||||
}
|
||||
$_SESSION['Bateaux']['page'] = "Accueil";
|
||||
Fermeture_bdd();
|
||||
header('Location: bateaux.php');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Dévalidation d'un bateau (administrateurs - contrôlé plus haut ; POST avec jeton) :
|
||||
if (isset($_POST['confirmation_suppression_bateau']))
|
||||
{
|
||||
$id_bateau = (int)$_POST['confirmation_suppression_bateau'];
|
||||
Requete_preparee_bdd('UPDATE TB_Bateaux SET Validite=0 WHERE Cle_primaire=? AND Validite=1', array(array('i', $id_bateau)), __FILE__, __LINE__);
|
||||
if (Nb_lignes_modifiees() == 1) $_SESSION['Bateaux']['flash_information'] = t("Le bateau a été dévalidé dans la base de données.");
|
||||
else $_SESSION['Bateaux']['flash_erreur'] = t("Ce bateau n'existe pas ou a déjà été dévalidé.");
|
||||
$_SESSION['Bateaux']['page'] = "Accueil";
|
||||
Fermeture_bdd();
|
||||
header('Location: bateaux.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// NB : les actions sur les accès et invitations (création, suspension, réactivation, révocation, modification, PDF)
|
||||
// sont traitées plus bas, dans la page Details_bateau, APRÈS le calcul des droits de l'utilisateur sur le bateau
|
||||
@@ -318,10 +368,9 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
$bateaux[$nb_bateaux] = $donnees;
|
||||
|
||||
// Mise en forme de certaines variables :
|
||||
if ($bateaux[$nb_bateaux]['version'] == "") $bateaux[$nb_bateaux]['version'] = '<i>inconnue</i>';
|
||||
$bateaux[$nb_bateaux]['version'] = ($donnees['version'] == "") ? '<i>inconnue</i>' : htmlspecialchars($donnees['version']);
|
||||
if ($donnees['Date_derniere_maj'] < "2020-01-02") $bateaux[$nb_bateaux]['Date_derniere_maj'] = "<i>Jamais</i>";
|
||||
else $bateaux[$nb_bateaux]['Date_derniere_maj'] = Formatage_date($donnees['Date_derniere_maj']);
|
||||
$bateaux[$nb_bateaux]['Commentaires'] = htmlspecialchars(stripcslashes($bateaux[$nb_bateaux]['Commentaires']));
|
||||
|
||||
$nb_bateaux ++;
|
||||
}
|
||||
@@ -572,30 +621,21 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
case "Modification_bateau":
|
||||
{
|
||||
//--------------------------------------------------
|
||||
// Préparation des variables du bateau :
|
||||
if ($_SESSION['Bateaux']['page'] == "Creation_bateau")
|
||||
// Préparation des variables du bateau. Création : formulaire réinitialisé par l'action "creation_bateau".
|
||||
// Modification : valeurs lues en base à l'ouverture du formulaire seulement (après une erreur de saisie, les
|
||||
// valeurs saisies sont conservées) :
|
||||
if ($_SESSION['Bateaux']['page'] == "Modification_bateau" && !empty($_SESSION['Bateaux']['charger_bateau']))
|
||||
{
|
||||
$_SESSION['Bateaux']['bateau']['Cle_primaire'] = 0;
|
||||
$_SESSION['Bateaux']['bateau']['Nom'] = "";
|
||||
$_SESSION['Bateaux']['bateau']['ID_Flotte'] = 0;
|
||||
$_SESSION['Bateaux']['bateau']['Date_mes'] = date("Y-m-d");
|
||||
$_SESSION['Bateaux']['bateau']['Commentaires'] = "";
|
||||
}
|
||||
else // Modification :
|
||||
{
|
||||
$requete = 'SELECT * FROM TB_Bateaux WHERE Cle_primaire=? ';
|
||||
unset($_SESSION['Bateaux']['charger_bateau']);
|
||||
$requete = 'SELECT Cle_primaire, Nom, ID_Flotte, Date_mes, Commentaires FROM TB_Bateaux WHERE Cle_primaire=? AND Validite=1';
|
||||
$reponse = Requete_preparee_bdd($requete,
|
||||
array(
|
||||
array('i', $_SESSION['Bateaux']['bateau']['Cle_primaire'])),
|
||||
__FILE__, __LINE__);
|
||||
while ($donnees = Recherche_ligne_bdd($reponse))
|
||||
{
|
||||
$_SESSION['Bateaux']['bateau'] = $donnees;
|
||||
|
||||
// Mise en forme de textes :
|
||||
$_SESSION['Bateaux']['bateau']['Commentaires'] = htmlspecialchars(stripcslashes($_SESSION['Bateaux']['bateau']['Commentaires']));
|
||||
}
|
||||
$donnees = Recherche_ligne_bdd($reponse);
|
||||
Liberation_jeu_de_resultat_bdd($reponse);
|
||||
if ($donnees) $_SESSION['Bateaux']['bateau'] = $donnees;
|
||||
else $_SESSION['Bateaux']['page'] = "Accueil";
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@@ -623,6 +663,13 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
//****************************************************************************************************************************
|
||||
case "Confirmation_suppression_bateau":
|
||||
{
|
||||
// Nom du bateau à confirmer, relu en base (auparavant : le dernier nom chargé en session, qui pouvait être celui
|
||||
// d'un AUTRE bateau) :
|
||||
$reponse = Requete_preparee_bdd('SELECT Cle_primaire, Nom FROM TB_Bateaux WHERE Cle_primaire=? AND Validite=1',
|
||||
array(array('i', $_SESSION['Bateaux']['bateau']['Cle_primaire'])), __FILE__, __LINE__);
|
||||
$bateau_a_supprimer = Recherche_ligne_bdd($reponse);
|
||||
Liberation_jeu_de_resultat_bdd($reponse);
|
||||
if (!$bateau_a_supprimer) $_SESSION['Bateaux']['page'] = "Accueil";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -677,12 +724,12 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
echo '<tr>
|
||||
<td>
|
||||
<a href="bateaux.php?action=details_bateau&id_bateau='.$bateaux[$i]['Cle_primaire'].'">
|
||||
'.$bateaux[$i]['Nom'].'
|
||||
'.htmlspecialchars($bateaux[$i]['Nom']).'
|
||||
</a>
|
||||
</td>';
|
||||
echo '<td>'.$bateaux[$i]['nom_flotte'].'</td>';
|
||||
echo '<td>'.htmlspecialchars((string)$bateaux[$i]['nom_flotte']).'</td>';
|
||||
// echo '<td>'.$bateaux[$i]['nom_carte'].'</td>';
|
||||
echo '<td>'.$bateaux[$i]['adresse_carte'].'</td>';
|
||||
echo '<td>'.htmlspecialchars((string)$bateaux[$i]['adresse_carte']).'</td>';
|
||||
echo '<td>'.$bateaux[$i]['version'].'</td>';
|
||||
echo '<td>'.$bateaux[$i]['Date_derniere_maj'].'</td>';
|
||||
// echo '<td>'.$bateaux[$i]['Commentaires'].'</td>';
|
||||
@@ -708,7 +755,7 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
{
|
||||
echo '<div id="details_bateau" class="page_principale">';
|
||||
|
||||
echo '<h1>Bateau <span class="gras">'.$bateau['Nom'].'</span></h1>';
|
||||
echo '<h1>Bateau <span class="gras">'.htmlspecialchars($bateau['Nom']).'</span></h1>';
|
||||
|
||||
echo '<div class="entete_bateau">';
|
||||
if ($_SESSION['shipmember']['Niveau_acces'] >= NIVEAU_ACCES_MINI_ADMINISTRATEUR || $acces_profil['Consultation_donnees'] == 2)
|
||||
@@ -716,12 +763,12 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
echo '<div class="bouton_gestion_acces">';
|
||||
echo '<a title="" href="bateaux.php?action=type_details_bateau&type=gerer_les_acces"';
|
||||
if ($_SESSION['Bateaux']['type_details_bateau'] == "gerer_les_acces") echo ' class="actif" '; echo '>
|
||||
'.$_SESSION['textes']['bateau']['details']['boutons']['acces'] .'
|
||||
'.t("Gestion des accès").'
|
||||
</a>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '<div class="derniere_maj">'.t("Derniere_connexion").' : <span class="gras">'.$bateau['Date_derniere_maj'].' [UTC]</span></div>';
|
||||
echo '<div class="derniere_maj">'.t("Dernières données reçues").' : <span class="gras">'.$bateau['Date_derniere_maj'].' [UTC]</span></div>';
|
||||
echo '</div>';
|
||||
//--------------------------------
|
||||
// Boutons de haut de page (les anciens onglets Carte/Batteries/Circuits/Réservoirs/Capteurs/Système, liés au
|
||||
@@ -740,8 +787,8 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
//===========================================================
|
||||
case "gerer_les_acces":
|
||||
{
|
||||
// Texte sûr pour le HTML (les données viennent des utilisateurs : noms, adresses...) :
|
||||
$h = function($texte) { return htmlspecialchars((string)$texte, ENT_QUOTES, 'UTF-8'); };
|
||||
// Convention (synthèse §48) : les textes traduits (t()) sont affichés tels quels - ils sont écrits dans les
|
||||
// fichiers de langue, pas saisis par les utilisateurs ; seules les DONNÉES (base, saisie) sont échappées.
|
||||
|
||||
echo '<div class="gestion_acces">';
|
||||
|
||||
@@ -750,16 +797,17 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
if ($peut_inviter)
|
||||
{
|
||||
echo '<div class="generer_code">';
|
||||
echo ' <form action="bateaux.php" method="POST">';
|
||||
echo ' <input type="email" name="email_invite" required maxlength="254" placeholder="'.$h(t("Adresse e-mail du destinataire")).'">';
|
||||
echo ' <input type="text" name="prenom_invite" maxlength="50" placeholder="'.$h(t("Prénom (facultatif)")).'">';
|
||||
echo ' <input type="text" name="nom_invite" maxlength="50" placeholder="'.$h(t("Nom (facultatif)")).'">';
|
||||
echo ' <h3>'.t("Inviter une personne sur ce bateau").'</h3>';
|
||||
echo ' <form action="bateaux.php" method="POST">'; echo Champ_jeton_csrf();
|
||||
echo ' <input type="email" name="email_invite" required maxlength="254" placeholder="'.t("Adresse e-mail du destinataire").'">';
|
||||
echo ' <input type="text" name="prenom_invite" maxlength="50" placeholder="'.t("Prénom (facultatif)").'">';
|
||||
echo ' <input type="text" name="nom_invite" maxlength="50" placeholder="'.t("Nom (facultatif)").'">';
|
||||
echo ' <select name="type_acces" required>';
|
||||
echo ' <option value="" disabled selected> -- '.$h(t("Type d'accès")).' -- </option>';
|
||||
for ($i = 0; $i < $type_acces_nb; $i++) echo '<option value="'.(int)$type_acces[$i]['Cle_primaire'].'">'.$h($type_acces[$i]['Nom']).'</option>';
|
||||
echo ' <option value="" disabled selected> -- '.t("Type d'accès").' -- </option>';
|
||||
for ($i = 0; $i < $type_acces_nb; $i++) echo '<option value="'.(int)$type_acces[$i]['Cle_primaire'].'">'.htmlspecialchars((string)$type_acces[$i]['Nom']).'</option>';
|
||||
echo ' </select>';
|
||||
echo ' <input type="date" name="fin_acces" title="'.$h(t("Fin de l'accès (facultatif)")).'">';
|
||||
echo ' <button type="submit" name="creer_invitation">'.$h(t("Inviter")).'</button>';
|
||||
echo ' <label class="fin_acces"><span>'.t("Fin de l'accès (facultatif)").'</span><input type="date" name="fin_acces"></label>';
|
||||
echo ' <button type="submit" name="creer_invitation">'.t("Inviter").'</button>';
|
||||
echo ' </form>';
|
||||
echo '</div>';
|
||||
}
|
||||
@@ -769,14 +817,14 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
echo '<div class="users">';
|
||||
echo ' <table>';
|
||||
echo ' <tr>';
|
||||
echo ' <th>'.$h(t("Statut")).'</th>';
|
||||
echo ' <th>'.$h(t("Shipmember")).'</th>';
|
||||
echo ' <th>'.$h(t("Créé_par")).'</th>';
|
||||
echo ' <th>'.$h(t("Type de profil")).'</th>';
|
||||
echo ' <th>'.$h(t("Fin de validité")).'</th>';
|
||||
echo ' <th>'.t("Statut").'</th>';
|
||||
echo ' <th>'.t("Destinataire").'</th>';
|
||||
echo ' <th>'.t("Créé par").'</th>';
|
||||
echo ' <th>'.t("Type de profil").'</th>';
|
||||
echo ' <th>'.t("Fin de validité").'</th>';
|
||||
echo ' <th></th>';
|
||||
echo ' </tr>';
|
||||
if ($utilisateur_acces_nb == 0) echo '<tr><td colspan="6">'.$h(t("Aucun accès ni invitation en cours.")).'</td></tr>';
|
||||
if ($utilisateur_acces_nb == 0) echo '<tr><td colspan="6">'.t("Aucun accès ni invitation en cours.").'</td></tr>';
|
||||
for ($i = 0; $i < $utilisateur_acces_nb; $i++)
|
||||
{
|
||||
$acces = $utilisateur_acces[$i];
|
||||
@@ -784,11 +832,15 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
// Statut affiché :
|
||||
switch ($acces['Statut'])
|
||||
{
|
||||
case 'actif': $statut = t("Actif"); break;
|
||||
case 'suspendu': $statut = t("Suspendu"); break;
|
||||
case 'actif': $statut = t("Actif"); $classe_statut = 'actif'; break;
|
||||
case 'suspendu': $statut = t("Suspendu"); $classe_statut = 'suspendu'; break;
|
||||
default:
|
||||
if ($acces['Expiree']) $statut = t("Invitation expirée");
|
||||
else $statut = str_replace("[[Date]]", date_format(date_create($acces['Expiration_invitation']), 'd/m/Y'), t("Invitation en attente (jusqu'au [[Date]])"));
|
||||
if ($acces['Expiree']) { $statut = t("Invitation expirée"); $classe_statut = 'expiree'; }
|
||||
else
|
||||
{
|
||||
$statut = str_replace("[[Date]]", date_format(date_create($acces['Expiration_invitation']), 'd/m/Y'), t("Invitation en attente (jusqu'au [[Date]])"));
|
||||
$classe_statut = 'en_attente';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -801,29 +853,29 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
if ($peut_devalider || ($acces['Statut'] == 'en_attente' && $peut_inviter)) $actions['revoquer'] = t("Révoquer");
|
||||
|
||||
echo ' <tr>';
|
||||
echo ' <td>'.$h($statut).'</td>';
|
||||
echo ' <td>'.$h($acces['Destinataire']).'</td>';
|
||||
echo ' <td>'.$h($acces['Cree_par_nom']).'</td>';
|
||||
echo ' <td>'.$h($acces['Niveau_acces_nom']).'</td>';
|
||||
echo ' <td>'.((substr($acces['Fin_validite'], 0, 10) == "9999-12-31") ? $h(t("Aucune")) : $h(date_format(date_create($acces['Fin_validite']), 'd/m/Y'))).'</td>';
|
||||
echo ' <td>';
|
||||
echo ' <td><span class="statut statut_'.$classe_statut.'">'.$statut.'</span></td>';
|
||||
echo ' <td>'.htmlspecialchars((string)$acces['Destinataire']).'</td>';
|
||||
echo ' <td>'.htmlspecialchars((string)$acces['Cree_par_nom']).'</td>';
|
||||
echo ' <td>'.htmlspecialchars((string)$acces['Niveau_acces_nom']).'</td>';
|
||||
echo ' <td>'.((substr($acces['Fin_validite'], 0, 10) == "9999-12-31") ? t("Aucune") : date_format(date_create($acces['Fin_validite']), 'd/m/Y')).'</td>';
|
||||
echo ' <td><div class="actions_acces">';
|
||||
if (count($actions) > 0)
|
||||
{
|
||||
echo '<form action="bateaux.php" method="POST">';
|
||||
echo '<form action="bateaux.php" method="POST">'; echo Champ_jeton_csrf();
|
||||
echo '<input type="hidden" name="ID" value="'.(int)$acces['ID'].'">';
|
||||
foreach ($actions as $code_action => $libelle)
|
||||
{
|
||||
echo '<button type="submit" name="action_acces" value="'.$code_action.'"';
|
||||
if ($code_action == 'revoquer') echo ' onclick="return window.confirm(\''.$h(addslashes(t("Révoquer définitivement cet accès ?"))).'\');"';
|
||||
echo '>'.$h($libelle).'</button> ';
|
||||
echo '<button type="submit" name="action_acces" value="'.$code_action.'" class="action_'.$code_action.'"';
|
||||
if ($code_action == 'revoquer') echo ' onclick="return window.confirm(\''.addslashes(t("Révoquer définitivement cet accès ?")).'\');"';
|
||||
echo '>'.$libelle.'</button> ';
|
||||
}
|
||||
echo '</form>';
|
||||
}
|
||||
if ($acces_profil['Modification_acces'] == 1)
|
||||
{
|
||||
echo '<span id="modifier_acces" onclick="popUpEditAccess('.$h(json_encode($acces)).')"></span>';
|
||||
echo '<span class="modifier_acces" title="'.t("Modifier le type ou la fin de l'accès").'" onclick="popUpEditAccess('.htmlspecialchars((string)json_encode($acces)).')"></span>';
|
||||
}
|
||||
echo ' </td>';
|
||||
echo '</div> </td>';
|
||||
echo ' </tr>';
|
||||
}
|
||||
echo ' </table>';
|
||||
@@ -839,31 +891,31 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
echo '<div id="popUpAcces" style="display: none;">';
|
||||
echo ' <div id="popUpAccesModal">';
|
||||
echo ' <div id="top_part">';
|
||||
echo ' <p>'.$h(t("Titre du popup")).'</p>';
|
||||
echo ' <p>'.t("Modification des droits").'</p>';
|
||||
echo ' <p id="close" onclick="closeEditAccess();"> </p>';
|
||||
echo ' </div>';
|
||||
echo ' <form action="bateaux.php" method="POST">';
|
||||
echo ' <form action="bateaux.php" method="POST">'; echo Champ_jeton_csrf();
|
||||
echo ' <label for="shipmemberForm" id="ShipMember">';
|
||||
echo ' <input id="shipmemberForm" type="text" value="" readonly>';
|
||||
echo ' <span>'.$h(t("Shipmember")).'</span>';
|
||||
echo ' <span>'.t("Shipmember").'</span>';
|
||||
echo ' </label>';
|
||||
echo ' <label for="cree_parForm" id="Cree_par">';
|
||||
echo ' <input id="cree_parForm" type="text" value="" readonly>';
|
||||
echo ' <span>'.$h(t("Créé par")).'</span>';
|
||||
echo ' <span>'.t("Créé par").'</span>';
|
||||
echo ' </label>';
|
||||
echo ' <label for="type_profilForm" id="Type_profil">';
|
||||
echo ' <select name="type_profil" id="type_profilForm" required>';
|
||||
echo ' <option value="" disabled selected> -- '.$h(t("Type d'accès")).' -- </option>';
|
||||
for ($i = 0; $i < $type_acces_nb; $i++) echo '<option value="'.(int)$type_acces[$i]['Cle_primaire'].'">'.$h($type_acces[$i]['Nom']).'</option>';
|
||||
echo ' <option value="" disabled selected> -- '.t("Type d'accès").' -- </option>';
|
||||
for ($i = 0; $i < $type_acces_nb; $i++) echo '<option value="'.(int)$type_acces[$i]['Cle_primaire'].'">'.htmlspecialchars((string)$type_acces[$i]['Nom']).'</option>';
|
||||
echo ' </select>';
|
||||
echo ' <span>'.$h(t("Type de profil")).'</span>';
|
||||
echo ' <span>'.t("Type de profil").'</span>';
|
||||
echo ' </label>';
|
||||
echo ' <label for="fin_validiteForm" id="Fin_validite">';
|
||||
echo ' <input id="fin_validiteForm" type="date" value="" name="fin_validite" required>';
|
||||
echo ' <span>'.$h(t("Fin de validite")).'</span>';
|
||||
echo ' <span>'.t("Fin de validite").'</span>';
|
||||
echo ' </label>';
|
||||
echo ' <input type="hidden" id="idForm" name="ID" value="">';
|
||||
echo ' <button type="submit" name="modifierAcces">'.$h(t("Mettre à jour")).'</button>';
|
||||
echo ' <button type="submit" name="modifierAcces">'.t("Mettre à jour").'</button>';
|
||||
echo ' </form>';
|
||||
echo ' </div>';
|
||||
echo '</div>';
|
||||
@@ -929,12 +981,12 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
|
||||
echo '<h1>Bateaux</h1>';
|
||||
|
||||
echo '<form action="bateaux.php" method="post">';
|
||||
echo '<form action="bateaux.php" method="post">'; echo Champ_jeton_csrf();
|
||||
|
||||
|
||||
|
||||
if ($_SESSION['Bateaux']['page'] == "Creation_bateau") echo '<h2>Nouveau bateau</h2>';
|
||||
else echo '<h2>Modification du bateau <span class="gras">'.$_SESSION['Bateaux']['bateau']['Nom'].'</span></h2>';
|
||||
else echo '<h2>Modification du bateau <span class="gras">'.htmlspecialchars($_SESSION['Bateaux']['bateau']['Nom']).'</span></h2>';
|
||||
|
||||
//----------------------------------------
|
||||
// Nom :
|
||||
@@ -943,7 +995,7 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
Nom
|
||||
</div>
|
||||
<div class="champs_valeur">
|
||||
<input name="Nom" placeholder="Par exemple : Et Si... 2" value="'.$_SESSION['Bateaux']['bateau']['Nom'].'" >
|
||||
<input name="Nom" placeholder="Par exemple : Et Si... 2" value="'.htmlspecialchars($_SESSION['Bateaux']['bateau']['Nom']).'" maxlength="50" >
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
@@ -954,7 +1006,7 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
Date de mise en service
|
||||
</div>
|
||||
<div class="champs_valeur">
|
||||
<input name="Date_mes" placeholder="Format Y-m-d" value="'.$_SESSION['Bateaux']['bateau']['Date_mes'].'" >
|
||||
<input name="Date_mes" placeholder="Format Y-m-d" value="'.htmlspecialchars($_SESSION['Bateaux']['bateau']['Date_mes']).'" >
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
@@ -969,7 +1021,7 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
for ($i=0; $i<$nb_flottes; $i++)
|
||||
{
|
||||
echo ' <option value="'.$flottes[$i]['Cle_primaire'].'" '; if ($flottes[$i]['Cle_primaire'] == $_SESSION['Bateaux']['bateau']['ID_Flotte']) echo 'selected'; echo '>
|
||||
'.$flottes[$i]['Nom'].'
|
||||
'.htmlspecialchars($flottes[$i]['Nom']).'
|
||||
</option>';
|
||||
}
|
||||
|
||||
@@ -984,7 +1036,7 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
Commentaires
|
||||
</div>
|
||||
<div class="champs_valeur">
|
||||
<textarea cols="" rows="" name="Commentaires" placeholder="Vos commentaires sur la bateau" autocomplete="off">'.$_SESSION['Bateaux']['bateau']['Commentaires'].'</textarea>
|
||||
<textarea cols="" rows="" name="Commentaires" placeholder="Vos commentaires sur la bateau" autocomplete="off">'.htmlspecialchars($_SESSION['Bateaux']['bateau']['Commentaires']).'</textarea>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
@@ -1000,7 +1052,7 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
{
|
||||
echo '<a title="" href="bateaux.php?action=navigation&destination=Accueil">Annuler</a>';
|
||||
echo '<button type="submit" name="validation_modification_bateau" title="Valider les modification de la bateau">Enregistrer les modifications</button>';
|
||||
echo '<a title="" href="bateaux.php?action=demande_suppression_bateau&id_bateau='.$_SESSION['Bateaux']['bateau']['Cle_primaire'].'">Supprimer la bateau</a>';
|
||||
echo '<a title="" href="bateaux.php?action=demande_suppression_bateau&id_bateau='.(int)$_SESSION['Bateaux']['bateau']['Cle_primaire'].'">Supprimer le bateau</a>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
@@ -1020,21 +1072,16 @@ $requete .= ' TB_Bateaux.Date_derniere_maj AS Date_derniere_maj, ';
|
||||
echo '<h1>Bateaux</h1>';
|
||||
|
||||
echo '<div class="message_confirmation">';
|
||||
|
||||
echo '<p>
|
||||
Confirmez-vous la suppression du bateau
|
||||
<span class="gras">';
|
||||
echo $_SESSION['Bateaux']['bateau']['Nom'];
|
||||
echo '</span> ?
|
||||
</p>';
|
||||
echo '<p>Si oui, son entrée dans la base de données sera dévalidée de la base de données.</p>';
|
||||
|
||||
echo '<p>Confirmez-vous la suppression du bateau <span class="gras">'.htmlspecialchars($bateau_a_supprimer['Nom']).'</span> ?</p>';
|
||||
echo '<p>Si oui, son entrée dans la base de données sera dévalidée.</p>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="boutons_bas_de_page">';
|
||||
// Confirmation envoyée en POST avec le jeton de session (auparavant : un simple lien GET suffisait) :
|
||||
echo '<form action="bateaux.php" method="post" class="boutons_bas_de_page">';
|
||||
echo Champ_jeton_csrf();
|
||||
echo '<a title="" href="bateaux.php?action=navigation&destination=Accueil">Annuler</a>';
|
||||
echo '<a title="" href="bateaux.php?action=confirmation_suppression_bateau&id_bateau='.$_SESSION['Bateaux']['bateau']['Cle_primaire'].'">Confirmer la suppression</a>';
|
||||
echo '</div>';
|
||||
echo '<button type="submit" name="confirmation_suppression_bateau" value="'.(int)$bateau_a_supprimer['Cle_primaire'].'">Confirmer la suppression</button>';
|
||||
echo '</form>';
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
||||
+157
-13
@@ -384,19 +384,6 @@ Fichier bateaux.php
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.gestion_acces .users table td#modifier_acces {
|
||||
background-image: url(images/stylo.png);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 80%;
|
||||
background-position: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
.gestion_acces .generer_code form{
|
||||
display: grid;
|
||||
grid-template-columns: 2fr 2fr 1fr;
|
||||
margin-bottom: 30px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.download{
|
||||
font-weight: 800;
|
||||
@@ -542,6 +529,144 @@ form.variables input{
|
||||
display: grid;
|
||||
}
|
||||
|
||||
/* --------------------- GESTION DES ACCÈS (synthèse §48) ----------------------*/
|
||||
|
||||
/* Formulaire d'invitation : 4 colonnes - adresse (2) / prénom / nom, puis type (2) / fin d'accès / bouton */
|
||||
.gestion_acces .generer_code {
|
||||
margin: 20px 0px 30px 0px;
|
||||
padding: 0px 20px 20px 20px;
|
||||
border: 1px solid var(--bleu_koriolan_transparent);
|
||||
border-radius: 10px;
|
||||
background-color: var(--blanc);
|
||||
}
|
||||
.gestion_acces .generer_code h3 {
|
||||
text-align: left;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.gestion_acces .generer_code form {
|
||||
display: grid;
|
||||
grid-template-columns: 2fr 2fr 1fr 1fr;
|
||||
column-gap: 15px;
|
||||
row-gap: 15px;
|
||||
align-items: end;
|
||||
}
|
||||
.gestion_acces .generer_code form input[name="email_invite"] {
|
||||
grid-column: span 2;
|
||||
}
|
||||
.gestion_acces .generer_code form select {
|
||||
grid-column: span 2;
|
||||
}
|
||||
.gestion_acces .generer_code form input,
|
||||
.gestion_acces .generer_code form select {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 42px;
|
||||
padding: 0px 10px;
|
||||
}
|
||||
.gestion_acces .generer_code form .fin_acces {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: left;
|
||||
}
|
||||
.gestion_acces .generer_code form .fin_acces span {
|
||||
font-size: 0.75em;
|
||||
color: var(--gris_pale);
|
||||
margin: 0px 0px 3px 5px;
|
||||
}
|
||||
.gestion_acces .generer_code form button {
|
||||
height: 42px;
|
||||
line-height: 1em;
|
||||
padding: 0px 10px;
|
||||
}
|
||||
|
||||
/* Tableau des accès */
|
||||
.gestion_acces .users table th {
|
||||
padding: 5px 10px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.gestion_acces .users table td:nth-child(1),
|
||||
.gestion_acces .users table th:nth-child(1) {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* Pastilles de statut */
|
||||
.gestion_acces .statut {
|
||||
display: inline-block;
|
||||
padding: 2px 10px;
|
||||
border-radius: 1em;
|
||||
font-size: 0.85em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.gestion_acces .statut_actif {
|
||||
background-color: rgba(2, 166, 2, 0.12);
|
||||
color: #027a02;
|
||||
}
|
||||
.gestion_acces .statut_suspendu {
|
||||
background-color: var(--jaune_post_it_transparent);
|
||||
color: #8a6d00;
|
||||
}
|
||||
.gestion_acces .statut_en_attente {
|
||||
background-color: var(--bleu_koriolan_transparent);
|
||||
color: var(--bleu_koriolan_fonce);
|
||||
}
|
||||
.gestion_acces .statut_expiree {
|
||||
background-color: var(--gris_tres_tres_pale);
|
||||
color: var(--gris_fonce);
|
||||
}
|
||||
|
||||
/* Actions de chaque ligne : boutons compacts ; "Révoquer" (définitif) en rouge, "Suspendre" en contour */
|
||||
.gestion_acces .actions_acces {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 6px;
|
||||
}
|
||||
.gestion_acces .actions_acces form {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.gestion_acces .actions_acces button {
|
||||
padding: 2px 12px;
|
||||
line-height: 1.6em;
|
||||
font-size: 0.85em;
|
||||
border-radius: 0.8em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.gestion_acces .actions_acces button.action_suspendre {
|
||||
background-color: var(--blanc);
|
||||
color: var(--bleu_koriolan_fonce);
|
||||
}
|
||||
.gestion_acces .actions_acces button.action_suspendre:hover {
|
||||
background-color: var(--bleu_koriolan_transparent);
|
||||
}
|
||||
.gestion_acces .actions_acces button.action_revoquer {
|
||||
background-color: var(--blanc);
|
||||
border-color: var(--rouge);
|
||||
color: var(--rouge);
|
||||
}
|
||||
.gestion_acces .actions_acces button.action_revoquer:hover {
|
||||
background-color: var(--rouge);
|
||||
color: var(--blanc);
|
||||
}
|
||||
.gestion_acces .actions_acces .modifier_acces {
|
||||
display: inline-block;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
flex: none;
|
||||
background-image: url(images/stylo.png);
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Confirmation de suppression d'un bateau : formulaire (bouton) aligné comme les liens de bas de page */
|
||||
#Bateaux #confirmation_suppression_bateau form.boutons_bas_de_page button {
|
||||
line-height: 2em;
|
||||
}
|
||||
|
||||
/* ------------------ Autres ---------------- */
|
||||
#dateSlider{
|
||||
margin-bottom: 50px !important;
|
||||
@@ -589,6 +714,13 @@ form.variables input{
|
||||
.gestion_acces{
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.gestion_acces .generer_code form {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
.gestion_acces .actions_acces,
|
||||
.gestion_acces .actions_acces form {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
form.variables {
|
||||
|
||||
padding : 0;
|
||||
@@ -602,3 +734,15 @@ form.variables input{
|
||||
width: 80%;
|
||||
}
|
||||
}
|
||||
|
||||
/* Petits écrans : formulaire d'invitation sur une colonne. Placé EN FIN de fichier : le bloc "max-width: 850px"
|
||||
ci-dessus s'applique aussi sous 580px et, venant après, l'emporterait sinon. */
|
||||
@media only screen and (max-width: 580px) {
|
||||
.gestion_acces .generer_code form {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.gestion_acces .generer_code form input[name="email_invite"],
|
||||
.gestion_acces .generer_code form select {
|
||||
grid-column: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,6 +131,69 @@ Fichier shipmembers.php
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
/* Mes invitations (synthèse §48) : une carte par invitation (texte, Accepter, Refuser), puis la saisie d'un code */
|
||||
#Shipmembers #accueil .invitations .aucune {
|
||||
text-align: left;
|
||||
font-style: italic;
|
||||
color: var(--gris_pale);
|
||||
}
|
||||
#Shipmembers #accueil .invitations form.invitation {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto auto;
|
||||
column-gap: 10px;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
padding: 10px 15px;
|
||||
border: 1px solid var(--bleu_koriolan);
|
||||
border-radius: 10px;
|
||||
background-color: var(--bleu_koriolan_transparent);
|
||||
}
|
||||
#Shipmembers #accueil .invitations form.invitation p {
|
||||
margin: 0px;
|
||||
text-align: left;
|
||||
}
|
||||
#Shipmembers #accueil .invitations button {
|
||||
padding: 2px 16px;
|
||||
line-height: 1.8em;
|
||||
border-radius: 0.8em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#Shipmembers #accueil .invitations button.refuser {
|
||||
background-color: var(--blanc);
|
||||
border-color: var(--rouge);
|
||||
color: var(--rouge);
|
||||
}
|
||||
#Shipmembers #accueil .invitations button.refuser:hover {
|
||||
background-color: var(--rouge);
|
||||
color: var(--blanc);
|
||||
}
|
||||
#Shipmembers #accueil .invitations form.saisie_code {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 25px;
|
||||
}
|
||||
#Shipmembers #accueil .invitations form.saisie_code input {
|
||||
width: 12em;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.15em;
|
||||
text-align: center;
|
||||
}
|
||||
#Shipmembers #accueil .invitations form.saisie_code input::placeholder {
|
||||
text-transform: none;
|
||||
letter-spacing: normal;
|
||||
}
|
||||
@media only screen and (max-width: 580px) {
|
||||
#Shipmembers #accueil .invitations form.invitation {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
row-gap: 10px;
|
||||
}
|
||||
#Shipmembers #accueil .invitations form.invitation p {
|
||||
grid-column: span 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------*/
|
||||
#Shipmembers #profil form {
|
||||
|
||||
@@ -171,7 +171,7 @@ Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session
|
||||
|
||||
|
||||
// Création du ShipMember :
|
||||
$requete = 'INSERT INTO TB_Shipmembers(Nom, Prenom, Entreprise, Rue, Code_postal, Ville, ID_PAYS, Telephone, Email, ID_LANGUAGES, Mdp, Date_creation_compte) VALUES (?,?,?,?,?,?,?,?,?,(SELECT ID FROM TB_Langues WHERE Prefix=?),?,?)';
|
||||
$requete = 'INSERT INTO TB_Shipmembers(Nom, Prenom, Entreprise, Rue, Code_postal, Ville, ID_PAYS, Telephone, Email, ID_LANGUAGES, Commentaires, Mdp, Date_creation_compte) VALUES (?,?,?,?,?,?,?,?,?,(SELECT ID FROM TB_Langues WHERE Prefix=?),?,?,?)';
|
||||
Requete_preparee_bdd($requete,
|
||||
array(
|
||||
array('s', $_SESSION['shipmember']['Nom']),
|
||||
@@ -184,6 +184,7 @@ Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session
|
||||
array('s', $_SESSION['shipmember']['Telephone']),
|
||||
array('s', $_SESSION['shipmember']['Email']),
|
||||
array('s', $_SESSION['langue']),
|
||||
array('s', ""),
|
||||
array('s', password_hash($password, PASSWORD_DEFAULT)),
|
||||
array('s', date("Y-m-d H:i:s"))),
|
||||
__FILE__, __LINE__);
|
||||
@@ -1256,7 +1257,7 @@ Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session
|
||||
// Mes invitations (synthèse §47) :
|
||||
echo '<div class="espace_shipmember invitations">';
|
||||
echo '<h2>'.t("Mes invitations").'</h2>';
|
||||
if (count($invitations) == 0) echo '<p>'.t("Aucune invitation en attente.").'</p>';
|
||||
if (count($invitations) == 0) echo '<p class="aucune">'.t("Aucune invitation en attente.").'</p>';
|
||||
foreach ($invitations as $invitation)
|
||||
{
|
||||
$texte = t("Bateau [[Bateau]] - accès [[Type]], proposé par [[Invitant]] (valable jusqu'au [[Date]]).");
|
||||
@@ -1266,8 +1267,8 @@ Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session
|
||||
$texte = str_replace("[[Date]]", date_format(date_create($invitation['Expiration_invitation']), 'd/m/Y'), $texte);
|
||||
echo '<form action="shipmembers.php" method="post" class="invitation">';
|
||||
echo '<p>'.$texte.'</p>';
|
||||
echo '<button type="submit" name="accepter_invitation" value="'.(int)$invitation['ID'].'">'.t("Accepter").'</button> ';
|
||||
echo '<button type="submit" name="refuser_invitation" value="'.(int)$invitation['ID'].'" onclick="return window.confirm(\''.addslashes(t("Refuser définitivement cette invitation ?")).'\');">'.t("Refuser").'</button>';
|
||||
echo '<button type="submit" name="accepter_invitation" value="'.(int)$invitation['ID'].'" class="accepter">'.t("Accepter").'</button> ';
|
||||
echo '<button type="submit" name="refuser_invitation" value="'.(int)$invitation['ID'].'" class="refuser" onclick="return window.confirm(\''.addslashes(t("Refuser définitivement cette invitation ?")).'\');">'.t("Refuser").'</button>';
|
||||
echo '</form>';
|
||||
}
|
||||
// Saisie manuelle d'un code (invitation papier, sans appareil photo) :
|
||||
|
||||
Reference in New Issue
Block a user