ajout d'un fichier de config
adaptation de toutes les pages pour utiliser le titre et la description du fichier de config
This commit is contained in:
parent
04669eed7e
commit
d9cc871f60
11
admin.php
11
admin.php
@ -146,6 +146,17 @@ function showAdminInterface() {
|
||||
<p>Gérez les accès temporaires à vos albums privés.</p>
|
||||
</div>
|
||||
</a>
|
||||
<a href="personnalisation.php" class="admin-menu-item">
|
||||
<div class="menu-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M12 20s8-3 8-10V4l-8-2-8 2v6c0 7 8 10 8 10z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="menu-content">
|
||||
<h2>Personnalisation</h2>
|
||||
<p>Personnalisez le titre et la description de votre galerie.</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php include 'footer.php'; ?>
|
||||
|
@ -44,13 +44,15 @@ $parentPath = dirname($currentPath);
|
||||
if (!isSecurePath($parentPath)) {
|
||||
$parentPath = null;
|
||||
}
|
||||
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php echo htmlspecialchars($currentAlbumInfo['title']); ?> - ICO</title>
|
||||
<title><?php echo htmlspecialchars($currentAlbumInfo['title']); ?> - <?php echo htmlspecialchars($config['site_title']); ?></title>
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
|
@ -144,6 +144,7 @@ $images = array_map(function($img) {
|
||||
}, $tempImages);
|
||||
|
||||
$currentAlbumInfo = getAlbumInfo($currentPath);
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
@ -151,7 +152,7 @@ $currentAlbumInfo = getAlbumInfo($currentPath);
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Gestion des images privées - ICO</title>
|
||||
<title>Gestion des images privées - <?php echo htmlspecialchars($config['site_title']); ?></title>
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<link rel="stylesheet" href="styles-admin.css">
|
||||
|
@ -185,6 +185,8 @@ usort($tempImages, function($a, $b) {
|
||||
$images = array_map(function($img) {
|
||||
return $img['name'];
|
||||
}, $tempImages);
|
||||
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
@ -192,7 +194,7 @@ $images = array_map(function($img) {
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Gestion des images - ICO</title>
|
||||
<title>Gestion des images - <?php echo htmlspecialchars($config['site_title']); ?></title>
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<link rel="stylesheet" href="styles-admin.css">
|
||||
|
@ -198,13 +198,15 @@ function generatePrivateTree($path, $currentPath) {
|
||||
$output .= '</ul>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Albums privés - ICO</title>
|
||||
<title>Albums privés - <?php echo htmlspecialchars($config['site_title']); ?></title>
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<link rel="stylesheet" href="styles-admin.css">
|
||||
|
@ -164,6 +164,8 @@ function generateTree($path, $currentPath) {
|
||||
$output .= '</ul>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
@ -171,7 +173,7 @@ function generateTree($path, $currentPath) {
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Arborescence - ICO</title>
|
||||
<title>Arborescence - <?php echo htmlspecialchars($config['site_title']); ?></title>
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<link rel="stylesheet" href="styles-admin.css">
|
||||
|
@ -86,13 +86,15 @@ $albumsResult = $db->query($albumsQuery);
|
||||
while ($row = $albumsResult->fetchArray(SQLITE3_ASSOC)) {
|
||||
$albums[] = $row;
|
||||
}
|
||||
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Gestion des clés de partage - ICO</title>
|
||||
<title>Gestion des clés de partage - <?php echo htmlspecialchars($config['site_title']); ?></title>
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<link rel="stylesheet" href="styles-admin.css">
|
||||
|
2
config.txt
Normal file
2
config.txt
Normal file
@ -0,0 +1,2 @@
|
||||
ICO
|
||||
ICO est la galerie d'images de l'association Camélia Studio.
|
@ -354,4 +354,21 @@ function getVersion() {
|
||||
}
|
||||
return 'inconnue'; // Version par défaut si le fichier n'existe pas
|
||||
}
|
||||
|
||||
function getSiteConfig() {
|
||||
$configFile = './config.txt';
|
||||
$config = [
|
||||
'site_title' => 'ICO',
|
||||
'site_description' => 'ICO est la galerie d\'images de l\'association Camélia Studio.'
|
||||
];
|
||||
|
||||
if (file_exists($configFile)) {
|
||||
$content = file_get_contents($configFile);
|
||||
$lines = explode("\n", $content);
|
||||
if (isset($lines[0])) $config['site_title'] = trim($lines[0]);
|
||||
if (isset($lines[1])) $config['site_description'] = trim($lines[1]);
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
?>
|
@ -60,13 +60,15 @@ if (empty($shareKey)) {
|
||||
$headerImage = !empty($images) ? $images[0] : null;
|
||||
}
|
||||
}
|
||||
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php echo isset($albumData) ? htmlspecialchars($albumData['title']) : htmlspecialchars($errorTitle); ?> - ICO</title>
|
||||
<title><?php echo isset($albumData) ? htmlspecialchars($albumData['title']) : htmlspecialchars($errorTitle); ?> - <?php echo htmlspecialchars($config['site_title']); ?></title>
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
|
@ -48,13 +48,15 @@ $parentPath = dirname($currentPath);
|
||||
if (!isSecurePath($parentPath)) {
|
||||
$parentPath = './liste_albums';
|
||||
}
|
||||
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php echo htmlspecialchars($albumInfo['title']); ?> - ICO</title>
|
||||
<title><?php echo htmlspecialchars($albumInfo['title']); ?> - <?php echo htmlspecialchars($config['site_title']); ?></title>
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
|
@ -31,6 +31,7 @@ function getCarouselImages($limit = 5) {
|
||||
}
|
||||
|
||||
$carouselImages = getCarouselImages();
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
@ -38,7 +39,7 @@ $carouselImages = getCarouselImages();
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ICO - Galerie d'images</title>
|
||||
<title><?php echo htmlspecialchars($config['site_title']); ?> - <?php echo htmlspecialchars($config['site_description']); ?></title>
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
@ -52,8 +53,8 @@ $carouselImages = getCarouselImages();
|
||||
</div>
|
||||
|
||||
<div class="overlay">
|
||||
<h1>ICO</h1>
|
||||
<p>ICO est la galerie d'images de l'association Camélia Studio.</p>
|
||||
<h1><?php echo htmlspecialchars($config['site_title']); ?></h1>
|
||||
<p><?php echo htmlspecialchars($config['site_description']); ?></p>
|
||||
<a href="albums.php" class="cta-button">Accéder aux galeries</a>
|
||||
</div>
|
||||
|
||||
|
@ -12,6 +12,7 @@ if (!$imageUrl) {
|
||||
|
||||
// Récupérer le nom du fichier pour le téléchargement
|
||||
$filename = basename($imageUrl);
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
@ -19,7 +20,7 @@ $filename = basename($imageUrl);
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Image - ICO</title>
|
||||
<title>Image - <?php echo htmlspecialchars($config['site_title']); ?></title>
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
|
89
personnalisation.php
Normal file
89
personnalisation.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
require_once 'fonctions.php';
|
||||
|
||||
session_start();
|
||||
if (!isset($_SESSION['admin_id'])) {
|
||||
header('Location: admin.php?action=login');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Gérer les soumissions du formulaire
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$siteTitle = $_POST['site_title'] ?? '';
|
||||
$siteDescription = $_POST['site_description'] ?? '';
|
||||
|
||||
// Vérifications basiques
|
||||
if (empty($siteTitle)) {
|
||||
$_SESSION['error_message'] = "Le titre du site est requis.";
|
||||
} else {
|
||||
// Sauvegarder la configuration
|
||||
$configContent = $siteTitle . "\n" . $siteDescription;
|
||||
|
||||
if (file_put_contents('./config.txt', $configContent) !== false) {
|
||||
$_SESSION['success_message'] = "Configuration mise à jour avec succès.";
|
||||
} else {
|
||||
$_SESSION['error_message'] = "Erreur lors de la sauvegarde de la configuration.";
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: personnalisation.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Récupérer la configuration actuelle
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Personnalisation - <?php echo htmlspecialchars($config['site_title']); ?></title>
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<link rel="stylesheet" href="styles-admin.css">
|
||||
</head>
|
||||
<body class="admin-page">
|
||||
<div class="admin-header">
|
||||
<h1>Personnalisation du site</h1>
|
||||
<div class="admin-actions">
|
||||
<a href="admin.php" class="action-button action-button-secondary">Retour</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="admin-content">
|
||||
<?php if (isset($_SESSION['success_message'])): ?>
|
||||
<div class="message success-message"><?php echo htmlspecialchars($_SESSION['success_message']); ?></div>
|
||||
<?php unset($_SESSION['success_message']); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($_SESSION['error_message'])): ?>
|
||||
<div class="message error-message"><?php echo htmlspecialchars($_SESSION['error_message']); ?></div>
|
||||
<?php unset($_SESSION['error_message']); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="personnalisation.php" class="form-container">
|
||||
<div class="form-group">
|
||||
<label for="site_title">Titre du site :</label>
|
||||
<input type="text" id="site_title" name="site_title" required
|
||||
value="<?php echo htmlspecialchars($config['site_title']); ?>">
|
||||
<small class="form-help">Ce titre apparaîtra dans l'en-tête des pages et la barre de titre du navigateur.</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="site_description">Description du site :</label>
|
||||
<textarea id="site_description" name="site_description" rows="4"
|
||||
class="form-textarea"><?php echo htmlspecialchars($config['site_description']); ?></textarea>
|
||||
<small class="form-help">Cette description apparaît sur la page d'accueil du site.</small>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="action-button">Enregistrer les modifications</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php include 'footer.php'; ?>
|
||||
</body>
|
||||
</html>
|
@ -301,6 +301,13 @@ body {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.form-help {
|
||||
display: block;
|
||||
margin-top: 0.5rem;
|
||||
color: #888;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
/* Toggle pour contenu mature */
|
||||
.toggle-label {
|
||||
display: flex;
|
||||
|
@ -150,6 +150,8 @@ $result = $db->query('SELECT * FROM admins ORDER BY id');
|
||||
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||
$users[] = $row;
|
||||
}
|
||||
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
@ -157,7 +159,7 @@ while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Gestion des utilisateurs - ICO</title>
|
||||
<title>Gestion des utilisateurs - <?php echo htmlspecialchars($config['site_title']); ?></title>
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<link rel="stylesheet" href="styles-admin.css">
|
||||
|
Loading…
x
Reference in New Issue
Block a user