From 97e50f245c3350429e0c88567d362eb26e2eba1c Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sat, 1 Jun 2024 21:19:56 +0200 Subject: [PATCH] 13.3.03 deux corrections --- .htaccess | 14 ++++++++++++++ CHANGES.md | 6 ++++++ LISEZMOI.md | 2 +- README.md | 2 +- core/class/layout.class.php | 4 ++-- core/core.php | 2 +- core/module/config/config.php | 6 ++++++ 7 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.htaccess b/.htaccess index 9bd3ba51..675e30ab 100644 --- a/.htaccess +++ b/.htaccess @@ -33,4 +33,18 @@ Options -Indexes # ne pas supprimer la ligne URL rewriting ! + + + + + # Enlever le slash final des URL +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{REQUEST_URI} ^(.+)/$ +RewriteRule ^ %1 [R=301,L] + # URL rewriting + + + + diff --git a/CHANGES.md b/CHANGES.md index 92de0c6d..6c0a85d2 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Changelog +## Versions 13.3.03 + +** Corrections :** +- L'ajout d'un slash en fin d'adresse avec la réécriture active provoquait une mauvaise détermination des adresses des images dans TinyMCE. Résolution : une directive htaccess supprime tous les slash en fin d'adresse. +- Lorsque la page est ouverte en édition, un clic sur le bouton édition dans la barre d'administration affiche une erreur, le lien étant incorrect. Afin d'éviter cette erreur et une redondance, le bouton d'édition est masqué lorsque la page est éditée. + ## Versions 13.3.01 - 13.2.02 diff --git a/LISEZMOI.md b/LISEZMOI.md index bd8d7f6f..d33347b5 100644 --- a/LISEZMOI.md +++ b/LISEZMOI.md @@ -1,4 +1,4 @@ -# ZwiiCMS 13.3.02 +# ZwiiCMS 13.3.03 Zwii est un CMS sans base de données (flat-file) qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation. diff --git a/README.md b/README.md index 14435e9d..c69b3260 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ZwiiCMS 13.3.02 +# ZwiiCMS 13.3.03 Zwii is a database-less (flat-file) CMS that allows you to easily create and manage a web site without any programming knowledge. diff --git a/core/class/layout.class.php b/core/class/layout.class.php index 49af25db..74d6438c 100644 --- a/core/class/layout.class.php +++ b/core/class/layout.class.php @@ -990,14 +990,14 @@ class layout extends common // Sur une page sans module or $this->getData(['page', $this->getUrl(0), 'moduleId']) === '' // Sur une page avec un module invalide - or (!is_null($this->getData(['page', $this->getUrl(2), 'moduleId'])) && + or (!is_null($this->getData(['page', $this->getUrl(2), 'moduleId'])) and !class_exists($this->getData(['page', $this->getUrl(2), 'moduleId'])) ) // Sur une page d'accueil or $this->getUrl(0) === '' ) { // Bouton Editer une page - if ($this->getUser('permission', 'page', 'edit')) { + if ($this->getUser('permission', 'page', 'edit') and $this->geturl(1) !== 'edit') { $leftItems .= '
  • ' . template::ico('pencil', [ 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0) . '/' . self::$siteContent, 'help' => 'Éditer la page' diff --git a/core/core.php b/core/core.php index 96908293..14286604 100644 --- a/core/core.php +++ b/core/core.php @@ -51,7 +51,7 @@ class common const ACCESS_TIMER = 1800; // Numéro de version - const ZWII_VERSION = '13.3.02'; + const ZWII_VERSION = '13.3.03'; // URL autoupdate const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/cms-update/raw/branch/master/'; diff --git a/core/module/config/config.php b/core/module/config/config.php index a55a2b0b..dbcbc103 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -524,6 +524,12 @@ class config extends common // Ajout des lignes dans le .htaccess $fileContent = file_get_contents('.htaccess'); $rewriteData = PHP_EOL . + ' # Enlever le slash final des URL' . PHP_EOL . + 'RewriteCond %{REQUEST_FILENAME} !-f' . PHP_EOL . + 'RewriteCond %{REQUEST_FILENAME} !-d' . PHP_EOL . + 'RewriteCond %{REQUEST_URI} ^(.+)/$' . PHP_EOL . + 'RewriteRule ^ %1 [R=301,L]' . PHP_EOL . + PHP_EOL . '# URL rewriting' . PHP_EOL . '' . PHP_EOL . "\tRewriteEngine on" . PHP_EOL .