From 05e0fad92253f135083cb7c26f8b078535c73c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Tue, 8 Feb 2022 21:19:39 +0100 Subject: [PATCH] Copy ok --- core/module/theme/theme.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index a754264e..6b2a7d90 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -583,22 +583,28 @@ class theme extends common { if ($this->isPost()) { $fontId = $this->getInput('fontAddFontId', null, true); $fontName = $this->getInput('fontAddFontName', null, true); - $file = $this->getInput('fontAddFile', null, true); - $e = explode ('/', $file); + $filePath = $this->getInput('fontAddFile', null, true); + $e = explode ('/', $filePath); $file = $e[count($e) - 1 ]; // Charger les données des fontes $files = $this->getData(['fonts', 'files']); $imported = $this->getData(['fonts', 'imported']); + // Concaténation dans les tableaux existants $imported = array_merge([$fontId => $fontName], $imported); $files = array_merge([$fontId => $file], $files); + + // Copier la fonte + copy ( self::FILE_DIR . 'source/' . $filePath, self::DATA_DIR . 'fonts/' . $file ); + // Mettre à jour le fichier des fontes $this->setData(['fonts', 'imported', $imported ]); $this->setData(['fonts', 'files', $files ]); // Valeurs en sortie + $this->addOutput([ - 'notification' => 'Fonte importée', + 'notification' => 'La fonte a été importée', 'redirect' => helper::baseUrl() . 'theme/fonts', 'state' => true ]);