From c6144c3aa84a23f0bad0886d4c7d2e7beca43e46 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 21 Mar 2022 11:18:01 +0100 Subject: [PATCH 1/3] update ajout des fontes locales --- core/include/update.inc.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 4ab116f2..b0375914 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -936,6 +936,20 @@ if ($this->getData(['core', 'dataVersion']) < 11400) { ]; $this->setData(['fonts', 'imported', $fonts]); + // Conversion des fontes locales + $files = $this->getData(['fonts', 'files']); + if (is_array($files)) { + $this->deleteData(['fonts', 'files']); + foreach ($files as $fontId => $fontName) { + $this->setData(['fonts', 'files', $fontId, [ + 'name' => ucfirst($fontId), + 'font-family'=> $fontId . ', sans-serif', + 'resource' => $fontName + ]]); + } + } + + // Rafraichir les thèmes if (file_exists(self::DATA_DIR . 'admin.css')) { unlink (self::DATA_DIR . 'admin.css'); From 9e229a5afeee77ce7fa5866b533ccdd02d201a5d Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 21 Mar 2022 11:37:45 +0100 Subject: [PATCH 2/3] Nom de la famille de fonte, suppressio du filtre short string --- core/module/theme/theme.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 437b0a5a..73eb6b9d 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -625,7 +625,7 @@ class theme extends common { $ressource = $type === 'imported' ? $this->getInput('fontAddUrl', helper::FILTER_STRING_SHORT) : $this->getInput('fontAddFile', helper::FILTER_STRING_SHORT); $fontId = $this->getInput('fontAddFontId', helper::FILTER_STRING_SHORT, true); $fontName = $this->getInput('fontAddFontName', helper::FILTER_STRING_SHORT, true); - $fontFamilyName = $this->getInput('fontAddFontFamilyName', helper::FILTER_STRING_SHORT, true); + $fontFamilyName = $this->getInput('fontAddFontFamilyName', null, true); // Supprime la fonte si elle existe dans le type inverse if (is_array($this->getData(['fonts', $typeFlip, $fontId])) ) { @@ -675,7 +675,7 @@ class theme extends common { $ressource = $type === 'imported' ? $this->getInput('fontEditUrl', helper::FILTER_STRING_SHORT) : $this->getInput('fontEditFile', helper::FILTER_STRING_SHORT); $fontId = $this->getInput('fontEditFontId', helper::FILTER_STRING_SHORT, true); $fontName = $this->getInput('fontEditFontName', helper::FILTER_STRING_SHORT, true); - $fontFamilyName = $this->getInput('fontEditFontFamilyName', helper::FILTER_STRING_SHORT, true); + $fontFamilyName = $this->getInput('fontEditFontFamilyName', null, true); // Supprime la fonte si elle existe dans le type inverse if (is_array($this->getData(['fonts', $typeFlip, $fontId])) ) { From 684212b0312a37649daa2cc94dc7ca029bb7578f Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 21 Mar 2022 11:38:52 +0100 Subject: [PATCH 3/3] idem pour les autres champs --- core/module/theme/theme.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 73eb6b9d..bb68422a 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -622,9 +622,9 @@ class theme extends common { // Type d'import en ligne ou local $type = $this->getInput('fontAddFontImported', helper::FILTER_BOOLEAN) ? 'imported' : 'files'; $typeFlip = $type === 'files' ? 'imported' : 'files'; - $ressource = $type === 'imported' ? $this->getInput('fontAddUrl', helper::FILTER_STRING_SHORT) : $this->getInput('fontAddFile', helper::FILTER_STRING_SHORT); - $fontId = $this->getInput('fontAddFontId', helper::FILTER_STRING_SHORT, true); - $fontName = $this->getInput('fontAddFontName', helper::FILTER_STRING_SHORT, true); + $ressource = $type === 'imported' ? $this->getInput('fontAddUrl', null) : $this->getInput('fontAddFile', null); + $fontId = $this->getInput('fontAddFontId', null, true); + $fontName = $this->getInput('fontAddFontName', null, true); $fontFamilyName = $this->getInput('fontAddFontFamilyName', null, true); // Supprime la fonte si elle existe dans le type inverse @@ -672,9 +672,9 @@ class theme extends common { // Type d'import en ligne ou local $type = $this->getInput('fontEditFontImported', helper::FILTER_BOOLEAN) ? 'imported' : 'files'; $typeFlip = $type === 'files' ? 'imported' : 'files'; - $ressource = $type === 'imported' ? $this->getInput('fontEditUrl', helper::FILTER_STRING_SHORT) : $this->getInput('fontEditFile', helper::FILTER_STRING_SHORT); - $fontId = $this->getInput('fontEditFontId', helper::FILTER_STRING_SHORT, true); - $fontName = $this->getInput('fontEditFontName', helper::FILTER_STRING_SHORT, true); + $ressource = $type === 'imported' ? $this->getInput('fontEditUrl', null) : $this->getInput('fontEditFile', null); + $fontId = $this->getInput('fontEditFontId', null, true); + $fontName = $this->getInput('fontEditFontName', null , true); $fontFamilyName = $this->getInput('fontEditFontFamilyName', null, true); // Supprime la fonte si elle existe dans le type inverse