From 2ad68ca01da11e252c7a91e875466c7498792ca7 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 9 Jan 2021 11:32:44 +0100 Subject: [PATCH 01/18] changes --- CHANGES.md | 3 ++- core/core.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1fdfabb8..5b4873e3 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ ## version 10.4.00 - Modifications : + - Filtrage des URL générées par facebook (FBCLID) occasionnant une erreur 404 - Captcha arithmétique, activation recommandée dans la configuration. - Module User - Pour les articles de blog et de news, choix de la signature, nom+prenom ; nom+prenom ; id ; pseudo @@ -15,9 +16,9 @@ - Approbation des commentaires - Gestion des thèmes : - Bouton de réinitialisation avec confirmation - - Traduction automatique dans la langue du navigateur. - Amélioration de la structure du flux RSS. + ## Version 10.3.13 Modifications : - Système de données (JsonDB) : diff --git a/core/core.php b/core/core.php index 95995258..e56a08de 100755 --- a/core/core.php +++ b/core/core.php @@ -1937,7 +1937,7 @@ class core extends common { $access = false; } } - // Empêcher l'accès aux page désactivée par URL directe + // Empêcher l'accès aux pages désactivées par URL directe if ( ( $this->getData(['page', $this->getUrl(0),'disable']) === true AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') ) OR ( -- 2.39.2 From 29a25242315935ffd4c660753f82d330e7ebddfe Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 9 Jan 2021 13:46:33 +0100 Subject: [PATCH 02/18] remove htaccess fix --- core/module/config/config.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/module/config/config.php b/core/module/config/config.php index 9da3c94f..85f34738 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -552,8 +552,6 @@ class config extends common { PHP_EOL . '' . PHP_EOL . "\tRewriteEngine on" . PHP_EOL . - "\tRewriteCond %{QUERY_STRING} ^(.*)&?fbclid=[^&]+&?(.*)$ [NC]". PHP_EOL . - "\tRewriteRule ^/?(.*)$ /$1?%1%2 [R=301,L]". PHP_EOL . "\tRewriteBase " . helper::baseUrl(false, false) . PHP_EOL . "\tRewriteCond %{REQUEST_FILENAME} !-f" . PHP_EOL . "\tRewriteCond %{REQUEST_FILENAME} !-d" . PHP_EOL . -- 2.39.2 From f86eee254cbb99ae5a1501f53f9942c9ad800ada Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 9 Jan 2021 13:49:25 +0100 Subject: [PATCH 03/18] remove getUrl fix --- core/core.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/core/core.php b/core/core.php index e56a08de..f335fbfb 100755 --- a/core/core.php +++ b/core/core.php @@ -561,16 +561,7 @@ class common { // Une partie de l'url else { $url = explode('/', $this->url); - if (array_key_exists($key, $url) ) { - if (strpos($url[$key],'fbclid=') === false) { - $result = $url[$key]; - } else { - $result = $key === 0 ? $this->getData(['config','homePageId']) : ''; - } - } else { - $result = null; - } - return $result; + return array_key_exists($key, $url) ? $url[$key] : null; } } -- 2.39.2 From 0feee84a238d7f7e420304522c3ebcb61b34dd6c Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 13 Jan 2021 18:45:39 +0100 Subject: [PATCH 04/18] =?UTF-8?q?Blog=201.4=20initialisation=20et=20couleu?= =?UTF-8?q?r=20des=20mots=20cl=C3=A9s=20par=20instance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.php | 6 ++++ module/search/ressource/defaultdata.php | 10 ++----- module/search/ressource/theme.css | 11 ------- module/search/ressource/vartheme.css | 3 -- module/search/search.php | 40 ++++++++++--------------- module/search/view/config/config.php | 2 +- module/search/view/index/index.css | 8 ++--- module/search/view/index/index.php | 6 ++-- 8 files changed, 30 insertions(+), 56 deletions(-) delete mode 100755 module/search/ressource/theme.css delete mode 100755 module/search/ressource/vartheme.css diff --git a/core/core.php b/core/core.php index f335fbfb..4ecb5b1e 100755 --- a/core/core.php +++ b/core/core.php @@ -1577,6 +1577,12 @@ class common { } } + // Supprimer les fichiers CSS devenus inutiles du module search + if (file_exists('module/search/ressource/theme.css') ) + unlink('module/search/ressource/theme.css'); + if (file_exists('module/search/ressource/vartheme.css') ) + unlink('module/search/ressource/vartheme.css'); + $this->setData(['core', 'dataVersion', 10400]); /** diff --git a/module/search/ressource/defaultdata.php b/module/search/ressource/defaultdata.php index 4eb9eaa6..d9d5a2a2 100755 --- a/module/search/ressource/defaultdata.php +++ b/module/search/ressource/defaultdata.php @@ -1,14 +1,10 @@ 'rgba(229, 229, 1, 1)' - ]; -} -class data extends search { +class init extends search { public static $defaultData = [ 'previewLength' => 100, 'resultHideContent' => false, 'placeHolder' => 'Un ou plusieurs mots-clés séparés par un espace ou par +', - 'submitText' => 'Rechercher' + 'submitText' => 'Rechercher', + 'keywordColor' => 'rgba(229, 229, 1, 1)' ]; } \ No newline at end of file diff --git a/module/search/ressource/theme.css b/module/search/ressource/theme.css deleted file mode 100755 index 63462103..00000000 --- a/module/search/ressource/theme.css +++ /dev/null @@ -1,11 +0,0 @@ -.searchTitle { - font: caption; - font-style: italic; - margin-left: 1em; -} -.searchKeyword { - background: var(--keywordColor); -} -.searchResult { - margin: .3em 0 .3em 1em; -} \ No newline at end of file diff --git a/module/search/ressource/vartheme.css b/module/search/ressource/vartheme.css deleted file mode 100755 index 9a5c4cdb..00000000 --- a/module/search/ressource/vartheme.css +++ /dev/null @@ -1,3 +0,0 @@ -.searchKeyword { - --keywordColor: #keywordColor#; -} diff --git a/module/search/search.php b/module/search/search.php index 4ad083e5..f84dfdeb 100755 --- a/module/search/search.php +++ b/module/search/search.php @@ -38,37 +38,31 @@ class search extends common { 400 => '400 caractères', ]; - // Message par défaut - public static $messagePlaceHolder = 'Un ou plusieurs mots-clés entre des espaces ou des guillemets'; - public static $messageButtontext = 'Rechercher'; - - const SEARCH_VERSION = '1.1'; + const SEARCH_VERSION = '1.2'; // Configuration vide public function config() { - // Initialisation des données de thème de la galerie dasn theme.json + // Création des valeurs de réglage par défaut + if ( $this->getData(['module', $this->getUrl(0)]) === null ) { + require_once('module/search/ressource/defaultdata.php'); + $this->setData(['module', $this->getUrl(0), init::$defaultData]); + } + if($this->isPost()) { // Soumission du formulaire - $this->setData(['theme', 'search', [ - 'keywordColor' => $this->getInput('searchKeywordColor') - ]]); $this->setData(['module', $this->getUrl(0), [ 'submitText' => $this->getInput('searchSubmitText'), 'placeHolder' => $this->getInput('searchPlaceHolder'), 'resultHideContent' => $this->getInput('searchResultHideContent',helper::FILTER_BOOLEAN), - 'previewLength' => $this->getInput('searchPreviewLength',helper::FILTER_INT) + 'previewLength' => $this->getInput('searchPreviewLength',helper::FILTER_INT), + 'keywordColor' => $this->getInput('searchKeywordColor') ]]); - // Création des fichiers CSS - $content = file_get_contents('module/search/ressource/vartheme.css'); - $themeCss = file_get_contents('module/search/ressource/theme.css'); - // Injection des variables - $content = str_replace('#keywordColor#',$this->getinput('searchKeywordColor'),$content ); - $success = file_put_contents('module/search/view/index/index.css',$content . $themeCss); + // Valeurs en sortie, affichage du formulaire $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(), - 'notification' => $success !== FALSE ? 'Modifications enregistrées' : 'Modifications non enregistées !', + 'notification' => $success !== FALSE ? 'Modifications enregistrées' : 'Modifications non enregistrées !', 'state' => $success !== FALSE ]); @@ -84,15 +78,11 @@ class search extends common { } public function index() { - // Création des valeurs de thème par défaut - if ( $this->getData(['theme', 'search']) === null ) { - require_once('module/search/ressource/defaultdata.php'); - $this->setData(['theme', 'search', theme::$defaultData]); - } + // Création des valeurs de réglage par défaut - if ( $this->getData(['module', 'search']) === null ) { + if ( $this->getData(['module', $this->getUrl(0)]) === null ) { require_once('module/search/ressource/defaultdata.php'); - $this->setData(['module', $this->getUrl(0), data::$defaultData]); + $this->setData(['module', $this->getUrl(0), init::$defaultData]); } if($this->isPost()) { @@ -241,7 +231,7 @@ class search extends common { // Découper l'aperçu $t = substr($contenu, $d ,$this->getData(['module',$this->getUrl(0),'previewLength'])); // Applique une mise en évidence - $t = preg_replace($keywords, '\1',$t); + $t = preg_replace($keywords, '\1',$t); // Sauver résultat $resultat .= '

'.$t.'...

'; $resultat .= '

' . count($matches[0]) . (count($matches[0]) === 1 ? ' correspondance

' : ' correspondances

'); diff --git a/module/search/view/config/config.php b/module/search/view/config/config.php index 8280ee9a..37a60653 100755 --- a/module/search/view/config/config.php +++ b/module/search/view/config/config.php @@ -59,7 +59,7 @@ 'class' => 'colorPicker', 'help' => 'Le curseur horizontal règle le niveau de transparence, le placer tout à la gauche pour un surlignement invisible.', 'label' => 'Surlignement', - 'value' => $this->getData(['theme', 'search', 'keywordColor']) + 'value' => $this->getData(['module', $this->getUrl(0), 'keywordColor']) ]); ?> diff --git a/module/search/view/index/index.css b/module/search/view/index/index.css index 8e5dc743..f3b5d574 100755 --- a/module/search/view/index/index.css +++ b/module/search/view/index/index.css @@ -1,14 +1,10 @@ -.searchKeyword { - --keywordColor: rgba(229, 229, 1, 1); -} + .searchTitle { font: caption; font-style: italic; margin-left: 1em; } -.searchKeyword { - background: var(--keywordColor); -} + .searchResult { margin: .3em 0 .3em 1em; } \ No newline at end of file diff --git a/module/search/view/index/index.php b/module/search/view/index/index.php index 4399c591..c766e21c 100755 --- a/module/search/view/index/index.php +++ b/module/search/view/index/index.php @@ -3,14 +3,14 @@

- $this->getData(['module', $this->getUrl(0), 'placeHolder']) ? $this->getData(['module', $this->getUrl(0), 'placeHolder']) : $module::$messagePlaceHolder, + "; echo isset($module::$motclef); echo "";echo template::text('searchMotphraseclef', [ + 'placeholder' => $this->getData(['module', $this->getUrl(0), 'placeHolder']), 'value' => $module::$motclef ]); ?>
$this->getData(['module', $this->getUrl(0), 'submitText']) ? $this->getData(['module', $this->getUrl(0), 'submitText']) : $module::$messageButtontext + 'value' => $this->getData(['module', $this->getUrl(0), 'submitText']) ]); ?>
-- 2.39.2 From 9b8d8c603fe4b8e904745bf92107939e0d3ff2d3 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 13 Jan 2021 18:47:30 +0100 Subject: [PATCH 05/18] supprimer un test --- module/search/view/index/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/search/view/index/index.php b/module/search/view/index/index.php index c766e21c..5fa91623 100755 --- a/module/search/view/index/index.php +++ b/module/search/view/index/index.php @@ -3,7 +3,7 @@
- "; echo isset($module::$motclef); echo "";echo template::text('searchMotphraseclef', [ + $this->getData(['module', $this->getUrl(0), 'placeHolder']), 'value' => $module::$motclef ]); ?> -- 2.39.2 From 668fda3d1da90b63cf6dec8e2ccd51f723b2018a Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 13 Jan 2021 19:03:37 +0100 Subject: [PATCH 06/18] =?UTF-8?q?Supprimer=20la=20cl=C3=A9=20'keywordColor?= =?UTF-8?q?'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.php | 1 + 1 file changed, 1 insertion(+) diff --git a/core/core.php b/core/core.php index 4ecb5b1e..f0b35e65 100755 --- a/core/core.php +++ b/core/core.php @@ -1582,6 +1582,7 @@ class common { unlink('module/search/ressource/theme.css'); if (file_exists('module/search/ressource/vartheme.css') ) unlink('module/search/ressource/vartheme.css'); + $this->deleteData(['theme','search','keywordColor']); $this->setData(['core', 'dataVersion', 10400]); -- 2.39.2 From d4d8f0eab520ad7b50088c1fdd00a20fbe7c5030 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 13 Jan 2021 19:08:28 +0100 Subject: [PATCH 07/18] Neutraliser cookie langue --- core/core.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/core.php b/core/core.php index f0b35e65..509527fb 100755 --- a/core/core.php +++ b/core/core.php @@ -193,9 +193,10 @@ class common { } // Déterminer le dossier de langues + /* if (isset($_POST['ZWII_USER_I18N'])) { self::$i18nCurrent = $_POST['ZWII_USER_I18N']; - } + }*/ // Instanciation de la classe des entrées / sorties // Récupère les descripteurs -- 2.39.2 From 2b8466428d4a2d799a86b9d02127c57ae738cd60 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 14 Jan 2021 14:48:00 +0100 Subject: [PATCH 08/18] data htaccess --- site/data/.htaccess | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/data/.htaccess b/site/data/.htaccess index ff0d5418..db3789af 100755 --- a/site/data/.htaccess +++ b/site/data/.htaccess @@ -1,5 +1,5 @@ # Bloque l'accès aux données - + Order deny,allow Deny from all - \ No newline at end of file + \ No newline at end of file -- 2.39.2 From da87070418a498e9051a80b75657ac6a3bb049c9 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 16 Jan 2021 19:09:21 +0100 Subject: [PATCH 09/18] Nettoyage des codes i18n --- core/core.php | 80 -------------------------------------------- core/layout/main.php | 4 +-- 2 files changed, 2 insertions(+), 82 deletions(-) diff --git a/core/core.php b/core/core.php index 509527fb..3af6c1ab 100755 --- a/core/core.php +++ b/core/core.php @@ -192,11 +192,6 @@ class common { $this->input['_COOKIE'] = $_COOKIE; } - // Déterminer le dossier de langues - /* - if (isset($_POST['ZWII_USER_I18N'])) { - self::$i18nCurrent = $_POST['ZWII_USER_I18N']; - }*/ // Instanciation de la classe des entrées / sorties // Récupère les descripteurs @@ -237,30 +232,6 @@ class common { $this->user = $this->getData(['user', $this->getInput('ZWII_USER_ID')]); } - // Traduction du site avec le script Google - if ( $this->getData(['config','translate','scriptGoogle'])) { - // Lire la langue stockée dans le cookie (choix manuel) - if ( isset($_COOKIE['ZWII_USER_I18N']) ) { - $lan_cookie = $_COOKIE['ZWII_USER_I18N']; - } - // Lire la langue du navigateur - if ( $this->getData(['config','translate','autoDetect'])) { - $lan_browser = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); - } - - // Priorité : choix manuel - navigateur - fr - $lan = isset($lan_cookie) ? $lan_cookie : (isset($lan_browser) ? $lan_browser : 'fr'); - - // Changer la locale - if ( $lan !== 'fr') { - setlocale (LC_TIME, $lan . '_' . strtoupper ($lan) ); - // Charge la librairie Google Translate - setrawcookie("googtrans", '/fr/'. $lan, time() + 3600, helper::baseUrl()); - } else { - setrawcookie("googtrans", '/fr/fr', time() + 3600, helper::baseUrl()); - } - } - // Construit la liste des pages parents/enfants if($this->hierarchy['all'] === []) { $pages = helper::arrayCollumn($this->getData(['page']), 'position', 'SORT_ASC'); @@ -2187,21 +2158,6 @@ class core extends common { } } - // Chargement de la librairie googtrans - // Le multi langue est actif - if ($this->getData(['config','translate','scriptGoogle']) === true ) { - // la traduction auto est active - if ( $this->getData(['config','translate','autoDetect']) === true - // Cas des pages d'administration - AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') - OR ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') - AND $this->getData(['config','translate','admin']) === true ) - ) { - $this->addOutput([ - 'vendor' => array_merge($this->output['vendor'], ['i18n']) - ]); - } - } // Erreurs if($access === 'login') { http_response_code(302); @@ -2338,26 +2294,6 @@ class layout extends common { echo $this->core->output['content']; - /** - * Affiche les crédits, conditions requis : - * La traduction est active et le site n'est pas en français. - * La fonction est activée. - */ - - if ( ( - ( $this->getData(['config','translate','scriptGoogle']) === true - AND substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) !== 'fr' - ) - OR ( isset($_COOKIES['ZWII_USER_I18N']) - AND array_key_exists($_COOKIES['ZWII_USER_I18N'],$this->i18nList - AND $_COOKIES['ZWII_USER_I18N'] !== 'fr' ) - ) - ) - AND $this->getData(['config','translate','showCredits']) === true - ) - { - echo ''; - } } @@ -3046,20 +2982,4 @@ class layout extends common { } } } - /** - * Affiche le cadre avec les drapeaux - */ - public function showi18n() { - if ( $this->getData(['config','translate','scriptGoogle']) === true ) { - echo '
    '; - foreach (self::$i18nList as $key => $value) { - if ($this->getData(['config','translate','script' . strtoupper($key)]) ) { - echo '
  • '; - echo ''; - echo '
  • '; - } - } - echo '
'; - } - } } diff --git a/core/layout/main.php b/core/layout/main.php index df3c1624..fb3eacfb 100755 --- a/core/layout/main.php +++ b/core/layout/main.php @@ -60,7 +60,7 @@ $lan = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); ?> getData(['theme', 'header', 'position']) === 'body'): ?>
- showi18n();?> + showi18n();?> getData(['theme','header','linkHomePage'])){ echo "" ;} ?> @@ -154,7 +154,7 @@ $lan = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); ?>
- showi18n();?> + showi18n();?> Date: Sat, 30 Jan 2021 12:25:03 +0100 Subject: [PATCH 10/18] Bug page null dans les modules --- CHANGES.md | 3 +++ core/core.php | 17 +++++++++++------ core/module/install/ressource/defaultdata.php | 12 +----------- core/module/page/page.php | 6 ++++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 5b4873e3..19895ff3 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,9 @@ # Changelog ## version 10.4.00 +Corrections : + - Bug de pages non accessibles dans le menu suite à la création d'entrées fantômes dans le fichier de données de modules. + - Nettoyage du fichiers des données de modules des entrées fantômes. - Modifications : - Filtrage des URL générées par facebook (FBCLID) occasionnant une erreur 404 - Captcha arithmétique, activation recommandée dans la configuration. diff --git a/core/core.php b/core/core.php index 3af6c1ab..f654b20a 100755 --- a/core/core.php +++ b/core/core.php @@ -44,7 +44,7 @@ class common { const ACCESS_TIMER = 1800; // Numéro de version - const ZWII_VERSION = '10.4.00.013'; + const ZWII_VERSION = '10.4.00.014'; const ZWII_UPDATE_CHANNEL = "v10"; public static $actions = []; @@ -1499,12 +1499,8 @@ class common { foreach ($pageList as $parentKey => $parent) { //La page est un blog if ($this->getData(['page',$parent,'moduleId']) === 'blog' ) { - //echo "
".$parent;
 					$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $parent, 'posts']), 'publishedOn', 'SORT_DESC'));
-					//var_dump($articleIds);
 					foreach ($articleIds as $key => $article) {
-						//echo $article;
-						//echo "

"; // Droits les deux groupes $this->setData(['module', $parent, 'posts', $article,'editConsent', 3]); // Limite de taille 500 @@ -1542,7 +1538,6 @@ class common { $path = realpath('site/data'); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename) { - echo "$filename
"; if (strpos($filename,'back.json')) { rename($filename, str_replace('back.json','backup.json',$filename)); } @@ -1556,6 +1551,16 @@ class common { unlink('module/search/ressource/vartheme.css'); $this->deleteData(['theme','search','keywordColor']); + // Nettoyer les modules avec des données null + + $modules = $this->getData(['module']); + foreach($modules as $key => $value) { + if (is_null($value) ) { + unset($modules[$key]); + } + } + $this->setData (['module',$modules]); + $this->setData(['core', 'dataVersion', 10400]); /** diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index c6ef26dd..1993a80c 100755 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -781,17 +781,7 @@ class init extends common { 'values' => '' ] ] - ], - 'locale' => [ - 'homePageId' => 'accueil', - 'page302' => 'erreur302', - 'page403' => 'erreur403', - 'page404' => 'erreur404', - 'legalPageId' => 'mentions-legales', - 'searchPageId' => 'recherche', - 'metaDescription' => 'Zwii est un CMS sans base de données qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation.', - 'title' => 'Votre site en quelques clics !' - ], + ] ] ]; } diff --git a/core/module/page/page.php b/core/module/page/page.php index 53372e8a..88e6b37f 100755 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -317,8 +317,10 @@ class page extends common { $this->setData(['page', $childrenPageId, 'parentPageId', $pageId]); } // Change l'id de page dans les données des modules - $this->setData(['module', $pageId, $this->getData(['module', $this->getUrl(2)])]); - $this->deleteData(['module', $this->getUrl(2)]); + if ($this->getData(['module', $this->getUrl(2)]) !== null ) { + $this->setData(['module', $pageId, $this->getData(['module', $this->getUrl(2)])]); + $this->deleteData(['module', $this->getUrl(2)]); + } // Si la page correspond à la page d'accueil, change l'id dans la configuration du site if($this->getData(['locale', 'homePageId']) === $this->getUrl(2)) { $this->setData(['locale', 'homePageId', $pageId]); -- 2.39.2 From 3b8b09df590c761984a87099be6cbd5ad7268c47 Mon Sep 17 00:00:00 2001 From: Prof Langues Date: Thu, 4 Feb 2021 16:41:54 +0100 Subject: [PATCH 11/18] =?UTF-8?q?015=20Effets=20d'agrandissements=20de=20l?= =?UTF-8?q?'image=20en=20arri=C3=A8re=20plan=20lorsque=20la=20page=20s'?= =?UTF-8?q?=C3=A9tire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.php | 21 ++++++++++++++------- core/module/theme/view/body/body.js.php | 7 ++++--- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/core/core.php b/core/core.php index f654b20a..3f47ba4d 100755 --- a/core/core.php +++ b/core/core.php @@ -44,7 +44,7 @@ class common { const ACCESS_TIMER = 1800; // Numéro de version - const ZWII_VERSION = '10.4.00.014'; + const ZWII_VERSION = '10.4.00.015'; const ZWII_UPDATE_CHANNEL = "v10"; public static $actions = []; @@ -1647,20 +1647,27 @@ class core extends common { $css = '/*' . md5(json_encode($this->getData(['theme']))) . '*/'; // Import des polices de caractères $css .= '@import url("https://fonts.googleapis.com/css?family=' . $this->getData(['theme', 'text', 'font']) . '|' . $this->getData(['theme', 'title', 'font']) . '|' . $this->getData(['theme', 'header', 'font']) . '|' . $this->getData(['theme', 'menu', 'font']) . '");'; - // Fond du site + // Fond du body $colors = helper::colorVariants($this->getData(['theme', 'body', 'backgroundColor'])); - $css .= 'body,div.mce-edit-area{background-color:' . $colors['normal'] . ';font-family:"' . str_replace('+', ' ', $this->getData(['theme', 'text', 'font'])) . '",sans-serif}'; - // Fond TinyMCe - $css .= 'div.mce-edit-area{background-color:' . $colors['normal'] . ' !important}'; + // Body + $css .= 'body{font-family:"' . str_replace('+', ' ', $this->getData(['theme', 'text', 'font'])) . '",sans-serif}'; if($themeBodyImage = $this->getData(['theme', 'body', 'image'])) { - $css .= 'body,div.mce-edit-area{background-image:url("../file/source/' . $themeBodyImage . '");background-position:' . $this->getData(['theme', 'body', 'imagePosition']) . ';background-attachment:' . $this->getData(['theme', 'body', 'imageAttachment']) . ';background-size:' . $this->getData(['theme', 'body', 'imageSize']) . ';background-repeat:' . $this->getData(['theme', 'body', 'imageRepeat']) . '}'; - $css .= 'div.mce-edit-area{background-image:url("../file/source/' . $themeBodyImage . '") !important;background-position:' . $this->getData(['theme', 'body', 'imagePosition']) . ';background-attachment:' . $this->getData(['theme', 'body', 'imageAttachment']) . ';background-size:' . $this->getData(['theme', 'body', 'imageSize']) . ';background-repeat:' . $this->getData(['theme', 'body', 'imageRepeat']) . '}'; + // Image dans html pour éviter les déformations. + $css .= 'html{background-image:url("../file/source/' . $themeBodyImage . '");background-position:' . $this->getData(['theme', 'body', 'imagePosition']) . ';background-attachment:' . $this->getData(['theme', 'body', 'imageAttachment']) . ';background-size:' . $this->getData(['theme', 'body', 'imageSize']) . ';background-repeat:' . $this->getData(['theme', 'body', 'imageRepeat']) . '}'; + // Couleur du body transparente + $css .= 'body{background-color: rgba(0,0,0,0)}'; + } else { + // Pas d'image couleur du body + $css .= 'html{background-color:' . $colors['normal'] . ';}'; } // Icône BacktoTop $css .= '#backToTop {background-color:' .$this->getData(['theme', 'body', 'toTopbackgroundColor']). ';color:'.$this->getData(['theme', 'body', 'toTopColor']).';}'; // Site $colors = helper::colorVariants($this->getData(['theme', 'text', 'linkColor'])); $css .= 'a{color:' . $colors['normal'] . '}'; + // Fond TinyMCe + $css .= 'div.mce-edit-area{background-color:' . $colors['normal'] . ' !important}'; + $css .= 'div.mce-edit-area{background-color:' . $colors['normal'] . ';font-family:"' . str_replace('+', ' ', $this->getData(['theme', 'text', 'font'])) . '",sans-serif}'; //$css .= 'a:hover:not(.inputFile, button){color:' . $colors['darken'] . '}'; $css .= 'body,.row > div{font-size:' . $this->getData(['theme', 'text', 'fontSize']) . '}'; $css .= 'body{color:' . $this->getData(['theme', 'text', 'textColor']) . '}'; diff --git a/core/module/theme/view/body/body.js.php b/core/module/theme/view/body/body.js.php index 4b46e333..cf08898d 100755 --- a/core/module/theme/view/body/body.js.php +++ b/core/module/theme/view/body/body.js.php @@ -22,14 +22,15 @@ $(document).ready(function(){ */ $("input, select").on("change", function() { // Couleur du fond - var css = "body{background-color:" + $("#themeBodyBackgroundColor").val() + "}"; + var css = "html{background-color:" + $("#themeBodyBackgroundColor").val() + "}"; // Image du fond var themeBodyImage = $("#themeBodyImage").val(); if(themeBodyImage) { - css += "body{background-image:url('site/file/source/" + themeBodyImage + "');background-repeat:" + $("#themeBodyImageRepeat").val() + ";background-position:" + $("#themeBodyImagePosition").val() + ";background-attachment:" + $("#themeBodyImageAttachment").val() + ";background-size:" + $("#themeBodyImageSize").val() + "}"; + css += "html{background-image:url('site/file/source/" + themeBodyImage + "');background-repeat:" + $("#themeBodyImageRepeat").val() + ";background-position:" + $("#themeBodyImagePosition").val() + ";background-attachment:" + $("#themeBodyImageAttachment").val() + ";background-size:" + $("#themeBodyImageSize").val() + "}"; + css += "html{background-color:rgba(0,0,0,0);}"; } else { - css += "body{background-image:none}"; + css += "html{background-image:none}"; } css += '#backToTop {background-color:' + $("#themeBodyToTopBackground").val() + ';color:' + $("#themeBodyToTopColor").val() + ';}'; -- 2.39.2 From 3facabaeca969c8cd57ad507774265abb2512b6f Mon Sep 17 00:00:00 2001 From: Prof Langues Date: Thu, 4 Feb 2021 16:52:37 +0100 Subject: [PATCH 12/18] =?UTF-8?q?Form=202.6=20Caract=C3=A8res=20sp=C3=A9ci?= =?UTF-8?q?aux=20mal=20affich=C3=A9s=20dans=20les=20noms=20des=20champs=20?= =?UTF-8?q?=20du=20formulaire=20lors=20de=20l'=C3=A9dition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/form/form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/form/form.php b/module/form/form.php index 955f40f0..5dc1f5c8 100755 --- a/module/form/form.php +++ b/module/form/form.php @@ -94,7 +94,7 @@ class form extends common { $inputs = []; foreach($this->getInput('formConfigPosition', null) as $index => $position) { $inputs[] = [ - 'name' => $this->getInput('formConfigName[' . $index . ']'), + 'name' => htmlspecialchars_decode($this->getInput('formConfigName[' . $index . ']'),ENT_QUOTES), 'position' => helper::filter($position, helper::FILTER_INT), 'required' => $this->getInput('formConfigRequired[' . $index . ']', helper::FILTER_BOOLEAN), 'type' => $this->getInput('formConfigType[' . $index . ']'), -- 2.39.2 From f6c1e2a9f371e0aba51252f837f4fd1801224165 Mon Sep 17 00:00:00 2001 From: Prof Langues Date: Thu, 4 Feb 2021 16:55:29 +0100 Subject: [PATCH 13/18] =?UTF-8?q?Form=20num=C3=A9ro=20de=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/form/form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/form/form.php b/module/form/form.php index 5dc1f5c8..3b17c1f4 100755 --- a/module/form/form.php +++ b/module/form/form.php @@ -32,7 +32,7 @@ class form extends common { public static $pagination; - const FORM_VERSION = '2.5'; + const FORM_VERSION = '2.6'; // Objets const TYPE_MAIL = 'mail'; -- 2.39.2 From 2935a4dd8ea71f09bb792f18b114960b93c5768b Mon Sep 17 00:00:00 2001 From: Prof Langues Date: Fri, 5 Feb 2021 10:07:58 +0100 Subject: [PATCH 14/18] =?UTF-8?q?Active=20la=20position=20fixe=20sur=20con?= =?UTF-8?q?tain=20ou=20cover=20dans=20l'image=20d'arri=C3=A8re=20plan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/module/theme/view/body/body.js.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/module/theme/view/body/body.js.php b/core/module/theme/view/body/body.js.php index cf08898d..19a42926 100755 --- a/core/module/theme/view/body/body.js.php +++ b/core/module/theme/view/body/body.js.php @@ -21,6 +21,15 @@ $(document).ready(function(){ * Aperçu en direct */ $("input, select").on("change", function() { + + // Option fixe pour contain et cover + var themeBodyImageSize = $("#themeBodyImageSize").val(); + + if(themeBodyImageSize === "cover" || + themeBodyImageSize === "contain" ) { + $("#themeBodyImageAttachment").val("fixed"); + } + // Couleur du fond var css = "html{background-color:" + $("#themeBodyBackgroundColor").val() + "}"; // Image du fond -- 2.39.2 From 17a7b6376131850484db8f2e0a56f1cbbcbfbb96 Mon Sep 17 00:00:00 2001 From: Prof Langues Date: Fri, 5 Feb 2021 11:23:08 +0100 Subject: [PATCH 15/18] =?UTF-8?q?Bug=20s=C3=A9lecteur=20de=20fichier=20lab?= =?UTF-8?q?el=20de=20type=20block=20plut=C3=B4t=20que=20inline-block?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/layout/common.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/layout/common.css b/core/layout/common.css index d96e1334..04f43261 100755 --- a/core/layout/common.css +++ b/core/layout/common.css @@ -1158,7 +1158,7 @@ textarea { } label { - display: inline-block; + display: block; margin-bottom: 4px; } -- 2.39.2 From e9c3c2ba220d23f0ab51e794bede4ee257490fbd Mon Sep 17 00:00:00 2001 From: Prof Langues Date: Fri, 5 Feb 2021 11:28:58 +0100 Subject: [PATCH 16/18] Changes --- CHANGES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 19895ff3..e1a6c91c 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,9 @@ Corrections : - Bug de pages non accessibles dans le menu suite à la création d'entrées fantômes dans le fichier de données de modules. - Nettoyage du fichiers des données de modules des entrées fantômes. + - Thème : déformation des images en arrière-plan dans les modes responsives cover et contain lorsque la longueur de la page change. L'image en arrière-plan est désormais placée dans la balise html et l'option fixe s'active lorsque cover ou contain sont sélectionnés. + - Thème : déformation du sélecteur de fichiers dans certains formats de page. + - Module Form : mauvais affichage du guillemet et de l'apostrophe dans les noms des champs lors de l'édition. - Modifications : - Filtrage des URL générées par facebook (FBCLID) occasionnant une erreur 404 - Captcha arithmétique, activation recommandée dans la configuration. -- 2.39.2 From 9367721d9933869422f0b72cd2783334094ead46 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 6 Feb 2021 19:05:46 +0100 Subject: [PATCH 17/18] =?UTF-8?q?bug=20de=20pr=C3=A9sentation=20login?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/layout/common.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/layout/common.css b/core/layout/common.css index 04f43261..3a7f49da 100755 --- a/core/layout/common.css +++ b/core/layout/common.css @@ -1162,6 +1162,10 @@ label { margin-bottom: 4px; } +.captcha label { + display:inline-block; +} + /* Simule le padding des cols pour les inputs en dehors des cols */ :not([class^="col"])>.inputWrapper { padding: 10px 0; -- 2.39.2 From 418f5d74d2ea8b3701fbd369a5b4a80059a7506d Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 6 Feb 2021 20:01:10 +0100 Subject: [PATCH 18/18] =?UTF-8?q?Faille=20csrf=20:=20r=C3=A9initialisation?= =?UTF-8?q?=20du=20custom.css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 1 + core/module/theme/theme.php | 60 ++++++++++++-------- core/module/theme/view/admin/admin.php | 2 +- core/module/theme/view/advanced/advanced.php | 2 +- core/module/theme/view/manage/manage.php | 2 +- 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e1a6c91c..43ae8d78 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ Corrections : - Thème : déformation des images en arrière-plan dans les modes responsives cover et contain lorsque la longueur de la page change. L'image en arrière-plan est désormais placée dans la balise html et l'option fixe s'active lorsque cover ou contain sont sélectionnés. - Thème : déformation du sélecteur de fichiers dans certains formats de page. - Module Form : mauvais affichage du guillemet et de l'apostrophe dans les noms des champs lors de l'édition. + - Thème : faille CSRF, protection de la réinitialisation des fichiers de thème. - Modifications : - Filtrage des URL générées par facebook (FBCLID) occasionnant une erreur 404 - Captcha arithmétique, activation recommandée dans la configuration. diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index a1820966..ff7c231e 100755 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -533,31 +533,43 @@ class theme extends common { * Réinitialisation de la personnalisation avancée */ public function reset() { - // Supprime le fichier de personnalisation avancée - $redirect =''; - switch ($this->getUrl(2)) { - case 'admin': - $this->initData('admin'); - $redirect = helper::baseUrl() . 'theme/admin'; - break; - case 'manage': - $this->initData('theme'); - $redirect = helper::baseUrl() . 'theme/manage'; - break; - case 'custom': - unlink(self::DATA_DIR.'custom.css'); - $redirect = helper::baseUrl() . 'theme/advanced'; - break; - default : - $redirect = helper::baseUrl() . 'theme'; - } + // $url prend l'adresse sans le token + $url = explode('&',$this->getUrl(2)); - // Valeurs en sortie - $this->addOutput([ - 'notification' => 'Réinitialisation effectuée', - 'redirect' => $redirect, - 'state' => true - ]); + if ( isset($_GET['csrf']) + AND $_GET['csrf'] === $_SESSION['csrf'] + ) { + // Réinitialisation + $redirect =''; + switch ($url[0]) { + case 'admin': + $this->initData('admin'); + $redirect = helper::baseUrl() . 'theme/admin'; + break; + case 'manage': + $this->initData('theme'); + $redirect = helper::baseUrl() . 'theme/manage'; + break; + case 'custom': + unlink(self::DATA_DIR.'custom.css'); + $redirect = helper::baseUrl() . 'theme/advanced'; + break; + default : + $redirect = helper::baseUrl() . 'theme'; + } + + // Valeurs en sortie + $this->addOutput([ + 'notification' => 'Réinitialisation effectuée', + 'redirect' => $redirect, + 'state' => true + ]); + } else { + // Valeurs en sortie + $this->addOutput([ + 'notification' => 'Jeton incorrect' + ]); + } } diff --git a/core/module/theme/view/admin/admin.php b/core/module/theme/view/admin/admin.php index 134e4bba..46c20ff3 100755 --- a/core/module/theme/view/admin/admin.php +++ b/core/module/theme/view/admin/admin.php @@ -16,7 +16,7 @@

'buttonRed', - 'href' => helper::baseUrl() . 'theme/reset/admin', + 'href' => helper::baseUrl() . 'theme/reset/admin' . '&csrf=' . $_SESSION['csrf'], 'value' => 'Réinitialiser', 'ico' => 'cancel' ]); ?> diff --git a/core/module/theme/view/advanced/advanced.php b/core/module/theme/view/advanced/advanced.php index c13fbd91..f1895306 100755 --- a/core/module/theme/view/advanced/advanced.php +++ b/core/module/theme/view/advanced/advanced.php @@ -10,7 +10,7 @@
helper::baseUrl() . 'theme/reset/custom', + 'href' => helper::baseUrl() . 'theme/reset/custom' . '&csrf=' . $_SESSION['csrf'], 'class' => 'buttonRed', 'ico' => 'cancel', 'value' => 'Réinitialiser' diff --git a/core/module/theme/view/manage/manage.php b/core/module/theme/view/manage/manage.php index 68de0814..42658cd9 100755 --- a/core/module/theme/view/manage/manage.php +++ b/core/module/theme/view/manage/manage.php @@ -11,7 +11,7 @@
'buttonRed', - 'href' => helper::baseUrl() . 'theme/reset/manage', + 'href' => helper::baseUrl() . 'theme/reset/manage' . '&csrf=' . $_SESSION['csrf'], 'value' => 'Réinitialiser', 'ico' => 'cancel' ]); ?> -- 2.39.2