From d42ac6ddba4a463a9382cb503e7b6645b02631ac Mon Sep 17 00:00:00 2001 From: Esenjin Date: Fri, 10 Jan 2025 15:37:04 +0100 Subject: [PATCH] =?UTF-8?q?l'acc=C3=A8s=20aux=20images=20priv=C3=A9es=20es?= =?UTF-8?q?t=20correctement=20prot=C3=A9g=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .htaccess | 6 ++++++ arbre-img-prive.php | 5 ++++- galeries-privees.php | 4 ++-- images.php | 34 ++++++++++++++++++++++++++++++++++ partage.php | 32 +++++++++++++++++++++++++++++--- version.txt | 2 +- 6 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 images.php diff --git a/.htaccess b/.htaccess index 714e49b..9837be1 100644 --- a/.htaccess +++ b/.htaccess @@ -37,4 +37,10 @@ Options -Indexes Header set X-Content-Type-Options "nosniff" Header set X-Frame-Options "SAMEORIGIN" Header set X-XSS-Protection "1; mode=block" + + +# Bloquer l'accès direct aux images privées + + RewriteEngine On + RewriteRule ^liste_albums_prives/.+\.(jpg|jpeg|png|gif)$ - [F] \ No newline at end of file diff --git a/arbre-img-prive.php b/arbre-img-prive.php index 617ca7c..661669b 100644 --- a/arbre-img-prive.php +++ b/arbre-img-prive.php @@ -228,7 +228,10 @@ $config = getSiteConfig();
getPathname(), strlen(realpath('./')))); - $url = $baseUrl . '/' . ltrim($relativePath, '/'); + $url = $baseUrl . '/images.php?path=' . urlencode($file->getPathname()) . '&key=' . urlencode($shareKey); // Vérifier que le fichier existe et est accessible if (file_exists($file->getPathname())) { $images[] = $url; @@ -148,7 +148,7 @@ $config = getSiteConfig(); } ?>