diff --git a/CHANGES.md b/CHANGES.md index 9daaf08d..7bc8c21c 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,7 @@ - Mauvais affichage du script ou du CSS déclarés dans une page. - Choix de la langue dans TinyMCE et CodeMirror. - Mauvaise application des fontes dans l'administration du thème. +- Corrige une mauvaise lecture du type de fonte éditée. - Correction de petits bugs. ### Nouveautés : - Remplacement du sélecteur de date Flatpickr par le sélecteur HTML 5 qui autorise les formats suivants : date, time, week, month, datetime-local. diff --git a/core/class/jsondb/JsonDb.class.php b/core/class/jsondb/JsonDb.class.php index 5e87d359..7d5332a5 100644 --- a/core/class/jsondb/JsonDb.class.php +++ b/core/class/jsondb/JsonDb.class.php @@ -142,17 +142,18 @@ class JsonDb extends \Prowebcraft\Dot */ public function save() { - $lenght = strlen(json_encode($this->data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | LOCK_EX)); - $try = 0; - while ($try < 5) { - $written = file_put_contents($this->db, json_encode($this->data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | LOCK_EX)); // Multi user get a locker - if ($written == $lenght) { + $v = json_encode($this->data, JSON_UNESCAPED_UNICODE | LOCK_EX); + $l = strlen($v); + $t = 0; + while ($t < 5) { + $w = file_put_contents($this->db, $v); // Multi user get a locker + if ($w == $l) { break; } $try++; sleep(1); } - if ($written !== $lenght) { + if ($w !== $l) { exit('Erreur d\'écriture, les données n\'ont pas été sauvegardées'); } diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index c5d4f1ab..4f42cdd1 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -657,7 +657,7 @@ class theme extends common // Soumission du formulaire if ($this->isPost()) { // Type d'import en ligne ou local - $type = $this->getInput('fontAddFontImported', helper::FILTER_BOOLEAN) ? 'imported' : 'files'; + $type = $this->getInput('fontAddUrl', helper::FILTER_BOOLEAN) ? 'imported' : 'files'; $typeFlip = $type === 'files' ? 'imported' : 'files'; $ressource = $type === 'imported' ? $this->getInput('fontAddUrl', null) : $this->getInput('fontAddFile', null); if (!empty($ressource)) { @@ -723,8 +723,7 @@ class theme extends common // Soumission du formulaire if ($this->isPost()) { // Type d'import en ligne ou local - $type = $this->getInput('fontEditFontImported', helper::FILTER_BOOLEAN) ? 'imported' : 'files'; - $typeFlip = $type === 'files' ? 'imported' : 'files'; + $type = $this->getInput('fontEditUrl', helper::FILTER_BOOLEAN) ? 'imported' : 'files'; $ressource = $type === 'imported' ? $this->getInput('fontEditUrl', null) : $this->getInput('fontEditFile', null); $fontId = $this->getInput('fontEditFontId', null, true); $fontName = $this->getInput('fontEditFontName', null, true); @@ -734,9 +733,10 @@ class theme extends common $fontFamilyName = str_replace('"', '\'', $fontFamilyName); // Supprime la fonte si elle existe dans le type inverse - if (is_array($this->getData(['font', $typeFlip, $fontId]))) { - $this->deleteData(['font', $typeFlip, $fontId]); + if (is_array($this->getData(['fonts', $type, $fontId]))) { + $this->deleteData(['fonts', $type, $fontId]); } + // Stocker les fontes $this->setData([ 'font',