Changement d'adresse dynamique

This commit is contained in:
Esteban
2026-07-09 14:40:26 +02:00
parent d7dc48454c
commit d47258fad8
5 changed files with 174 additions and 5 deletions
+90
View File
@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Logo pixel art</title>
<style>
html, body {
margin: 0;
height: 100%;
background: #000000;
display: flex;
align-items: center;
justify-content: center;
}
canvas {
image-rendering: pixelated;
}
</style>
</head>
<body>
<canvas id="art"></canvas>
<script>
const CELL = 20;
const COLOR = "#d57353";
// Grille generee automatiquement a partir de l'image source
// (detection auto de la taille de cellule + de l'alignement).
const grid = [
"............................................",
"............................................",
"............................................",
"............................................",
"............................................",
"............................................",
".....................###....................",
".....................###....................",
"......................#.....................",
"......................#.....................",
"......................#.....................",
"......................##....................",
"..............#################.............",
"..............##################............",
"..............##################............",
"..............##################............",
".............####################...........",
"............#####..#######..######..........",
"............#####..#######..######..........",
".......#.#..#####..#######..######..........",
".......####.#####..#######..######..........",
".......###...####..#######..#####...........",
"........##....##################............",
"........##....######.###.#######............",
"........##....#######...########............",
"........###....################.............",
".........####..################.............",
"..........#######################...........",
"............######################..........",
"...............################.##..........",
"...............################.##..........",
"...............################.##..........",
"...............#####......#####.##..........",
"...............####.......#####.#...........",
"................###.......###...............",
"................###.......###...............",
"...............####.......#####.............",
"............................................",
"............................................",
"............................................",
"............................................",
"............................................",
"............................................",
"............................................"
];
const canvas = document.getElementById("art");
const cols = grid[0].length;
const rows = grid.length;
canvas.width = cols * CELL;
canvas.height = rows * CELL;
const ctx = canvas.getContext("2d");
ctx.fillStyle = COLOR;
for (let r = 0; r < rows; r++) {
for (let c = 0; c < cols; c++) {
if (grid[r][c] === "#") {
ctx.fillRect(c * CELL, r * CELL, CELL, CELL);
}
}
}
</script>
</body>
</html>
+6 -1
View File
@@ -73,7 +73,12 @@ INSERT INTO settings (name, value) VALUES
('site_notice_title', 'Des bugs peuvent encore se produire.'),
('site_notice_text', 'Si le CSS ou les images s''affichent mal, pensez à vider le cache de votre navigateur (Ctrl + F5 ou Cmd + Shift + R) pour voir les dernières modifications.'),
('site_notice_enabled', '1'),
('captcha_enabled', '1')
('captcha_enabled', '1'),
('contact_email', 'esteban.moussu@ik.me'),
('contact_email_enabled', '1'),
('contact_address_line1', '20 Grande rue'),
('contact_address_line2', '52500 Broncourt'),
('contact_address_enabled', '1')
ON DUPLICATE KEY UPDATE value = VALUES(value);
-- items : un item par ligne, au format "classes-icone|Texte" (icône optionnelle)
+47
View File
@@ -55,6 +55,13 @@ $noticeEnabled = recupererSetting('site_notice_enabled') ?? '1';
// Valeur actuelle du captcha anti-robot (activé par défaut)
$captchaEnabled = recupererSetting('captcha_enabled') ?? '1';
// Valeurs actuelles des coordonnées de la page contact
$contactEmail = recupererSetting('contact_email') ?? 'esteban.moussu@ik.me';
$contactEmailEnabled = recupererSetting('contact_email_enabled') ?? '1';
$contactAddressLine1 = recupererSetting('contact_address_line1') ?? '20 Grande rue';
$contactAddressLine2 = recupererSetting('contact_address_line2') ?? '52500 Broncourt';
$contactAddressEnabled = recupererSetting('contact_address_enabled') ?? '1';
// Page du panneau d'administration
?>
@@ -73,6 +80,7 @@ $captchaEnabled = recupererSetting('captcha_enabled') ?? '1';
<a href="#admin-ecoles"><i class="fa-solid fa-graduation-cap"></i> Écoles</a>
<a href="#admin-competences"><i class="fa-solid fa-code"></i> Compétences</a>
<a href="#admin-logos"><i class="fa-solid fa-images"></i> Logos</a>
<a href="#admin-contact"><i class="fa-solid fa-address-card"></i> Contact</a>
<a href="#admin-notification"><i class="fa-solid fa-bell"></i> Notification</a>
<a href="#admin-securite"><i class="fa-solid fa-shield-halved"></i> Sécurité</a>
<a href="#admin-utilisateurs"><i class="fa-solid fa-users"></i> Utilisateurs</a>
@@ -377,6 +385,45 @@ $captchaEnabled = recupererSetting('captcha_enabled') ?? '1';
<?php afficherLogosAdmin(); ?>
</section>
<!-- ========== SECTION CONTACT ========== -->
<section id="admin-contact" class="admin-section">
<h2 class="admin-section-title"><i class="fa-solid fa-address-card"></i> Coordonnées de contact</h2>
<div class="project-container">
<div class="project-form-card">
<!-- on envoie les données à updateSettings.php -->
<form method="POST" action="../scripts/updateSettings.php">
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars(csrfToken()); ?>">
<input type="hidden" name="settings_group" value="contact">
<label>Adresse email</label>
<input type="email" name="contact_email" value="<?php echo htmlspecialchars($contactEmail); ?>">
<!-- Checkbox pour afficher / masquer l'email sur la page contact -->
<label class="checkbox-row">
<input type="checkbox" name="contact_email_enabled" value="1" <?php echo $contactEmailEnabled === '1' ? 'checked' : ''; ?>>
Afficher l'email sur la page contact
</label>
<label>Adresse postale - ligne 1 (rue)</label>
<input type="text" name="contact_address_line1" value="<?php echo htmlspecialchars($contactAddressLine1); ?>">
<label>Adresse postale - ligne 2 (code postal / ville)</label>
<input type="text" name="contact_address_line2" value="<?php echo htmlspecialchars($contactAddressLine2); ?>">
<!-- Checkbox pour afficher / masquer l'adresse postale sur la page contact -->
<label class="checkbox-row">
<input type="checkbox" name="contact_address_enabled" value="1" <?php echo $contactAddressEnabled === '1' ? 'checked' : ''; ?>>
Afficher l'adresse postale sur la page contact
</label>
<input type="submit" name="submitsettings" value="Enregistrer les coordonnées" class="btn-submit">
</form>
</div>
</div>
</section>
<!-- ========== SECTION NOTIFICATION ========== -->
<section id="admin-notification" class="admin-section">
<h2 class="admin-section-title"><i class="fa-solid fa-bell"></i> Notification de la page d'accueil</h2>
+17 -3
View File
@@ -6,6 +6,16 @@ $pageTitle = 'Contact';
// On ajoute ici le header
require_once("../elements/header.php");
// Réglages de l'email et de l'adresse (modifiables et masquables depuis l'admin)
require_once('../functions/listSettings.php');
$contactEmail = recupererSetting('contact_email') ?? 'esteban.moussu@ik.me';
$contactEmailEnabled = (recupererSetting('contact_email_enabled') ?? '1') === '1';
$contactAddressLine1 = recupererSetting('contact_address_line1') ?? '20 Grande rue';
$contactAddressLine2 = recupererSetting('contact_address_line2') ?? '52500 Broncourt';
$contactAddressEnabled = (recupererSetting('contact_address_enabled') ?? '1') === '1';
?>
<div class="contact-page">
@@ -14,9 +24,13 @@ require_once("../elements/header.php");
<div class="contact-info">
<p class="contact-title">Contact</p>
<p class="contact-name">Esteban MOUSSU</p>
<p class="contact-line"><i class="fa-solid fa-envelope"></i> esteban.moussu@ik.me</p>
<p class="contact-line"><i class="fa-solid fa-location-dot"></i> 20 Grande rue</p>
<p class="contact-line">52500 Broncourt</p>
<?php if ($contactEmailEnabled && !empty($contactEmail)): ?>
<p class="contact-line"><i class="fa-solid fa-envelope"></i> <?php echo htmlspecialchars($contactEmail); ?></p>
<?php endif; ?>
<?php if ($contactAddressEnabled && (!empty($contactAddressLine1) || !empty($contactAddressLine2))): ?>
<p class="contact-line"><i class="fa-solid fa-location-dot"></i> <?php echo htmlspecialchars($contactAddressLine1); ?></p>
<p class="contact-line"><?php echo htmlspecialchars($contactAddressLine2); ?></p>
<?php endif; ?>
</div>
<!-- Formulaire d'envoi -->
+14 -1
View File
@@ -31,6 +31,14 @@ if ($groupeReglages === 'captcha') {
$reglages = [
'captcha_enabled' => isset($_POST['captcha_enabled']) ? '1' : '0'
];
} elseif ($groupeReglages === 'contact') {
$reglages = [
'contact_email' => trim($_POST['contact_email'] ?? ''),
'contact_email_enabled' => isset($_POST['contact_email_enabled']) ? '1' : '0',
'contact_address_line1' => trim($_POST['contact_address_line1'] ?? ''),
'contact_address_line2' => trim($_POST['contact_address_line2'] ?? ''),
'contact_address_enabled' => isset($_POST['contact_address_enabled']) ? '1' : '0'
];
} else {
$reglages = [
'site_notice_title' => trim($_POST['notice_title'] ?? ''),
@@ -54,7 +62,12 @@ try { // On essaie d'executer une requête qui est préparée pour chaque régla
}
// Log Discord
sendLog("Modification de la notification de la page d'accueil");
$libellesGroupes = [
'captcha' => 'Modification du réglage du captcha',
'contact' => 'Modification des coordonnées de contact',
'notice' => "Modification de la notification de la page d'accueil"
];
sendLog($libellesGroupes[$groupeReglages] ?? "Modification des réglages du site");
// On renvoie l'utilisateur sur admin.php
header('Location: ../pages/admin.php');