From f8683cc9e6f384a945c4516612ae007c61c2facf Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 7 Jan 2021 09:48:53 +0100 Subject: [PATCH 1/7] .backup marqueur du backup --- README.md | 7 ++++--- core/core.php | 2 +- core/module/config/config.php | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e09fe264..71521879 100755 --- a/README.md +++ b/README.md @@ -74,9 +74,9 @@ Pour revenir à la version 8, renommez ce fichier "data.json". [R] fr Dossier localisé [F] page.json Données des pages [F] module.json Données des modules de pages - [F] admin.css Thème de la partie administration - [F] admin.json Données de la partie administration - [F] blacklist.json Données de connexion des comptes inconnus + [F] admin.css Thème des pages d'administration + [F] admin.json Données de thème des pages d'administration + [F] blacklist.json Journalisation des tentatives de connexion avec des comptes inconnus [F] config.json Configuration du site [F] core.json Configuration du noyau [F] custom.css Feuille de style de la personnalisation avancée @@ -84,6 +84,7 @@ Pour revenir à la version 8, renommez ce fichier "data.json". [F] theme.css Thème du site [F] theme.json Données du site [F] user.json Données des utilisateurs + [F] .backup Marqueur de la sauvegarde des fichiers si présent [R] file Répertoire d'upload du gestionnaire de fichiers [R] source Ressources diverses [R] thumb Miniatures des images diff --git a/core/core.php b/core/core.php index 2e5bc281..7b08cac5 100755 --- a/core/core.php +++ b/core/core.php @@ -204,7 +204,7 @@ class common { $this->dataFiles[$keys] = new \Prowebcraft\JsonDb([ 'name' => $keys . '.json', 'dir' => $this->dataPath ($keys,self::$i18nCurrent), - 'backup' => $keys === 'config' ? true : $this->getData(['config','fileBackup']) + 'backup' => file_exists('site/data/.backup') ]);; } diff --git a/core/module/config/config.php b/core/module/config/config.php index 355e9393..04e381aa 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -535,6 +535,9 @@ class config extends common { unlink($filename); } } + if (file_exists('site/data/.backup')) unlink('site/data/.backup'); + } else { + touch('site/data/.backup'); } // Notice if(self::$inputNotices === []) { From 29036af835e109c623e6727199f4dc6f6d773715 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 7 Jan 2021 09:49:57 +0100 Subject: [PATCH 2/7] =?UTF-8?q?mail=20de=20notification=20nom=20erron?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/blog/blog.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/blog/blog.php b/module/blog/blog.php index 5cb40fb2..72331d3e 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -635,7 +635,7 @@ class blog extends common { $sent = $this->sendMail( $to, 'Nouveau commentaire déposé', - 'Bonjour' . ' ' . $user['firstname'] . ' ' . $user['lastname'] . ',

' . + 'Bonjour

' . 'L\'article ' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . ' a reçu un nouveau commentaire.

', '' ); From beff8b10120c1d7bace7a1b4d7828e38e61b8a6c Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 8 Jan 2021 10:37:56 +0100 Subject: [PATCH 3/7] =?UTF-8?q?marqueur=20filebackup=20=20pas=20dans=20les?= =?UTF-8?q?=20donn=C3=A9es=20de=20site=20mais=20un=20fichier=20.backup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.php | 2 +- core/module/config/config.php | 1 - core/module/config/view/advanced/advanced.php | 2 +- core/module/install/ressource/defaultdata.php | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/core/core.php b/core/core.php index 7b08cac5..738b4fa8 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.012'; + const ZWII_VERSION = '10.4.00.013'; const ZWII_UPDATE_CHANNEL = "v10"; public static $actions = []; diff --git a/core/module/config/config.php b/core/module/config/config.php index 04e381aa..85f34738 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -485,7 +485,6 @@ class config extends common { [ 'analyticsId' => $this->getInput('configAdvancedAnalyticsId'), 'autoBackup' => $this->getInput('configAdvancedAutoBackup', helper::FILTER_BOOLEAN), - 'fileBackup' => $this->getInput('configAdvancedFileBackup', helper::FILTER_BOOLEAN), 'maintenance' => $this->getInput('configAdvancedMaintenance', helper::FILTER_BOOLEAN), 'cookieConsent' => $this->getInput('configAdvancedCookieConsent', helper::FILTER_BOOLEAN), 'favicon' => $this->getInput('configAdvancedFavicon'), diff --git a/core/module/config/view/advanced/advanced.php b/core/module/config/view/advanced/advanced.php index 7bcd6a4a..06718e43 100644 --- a/core/module/config/view/advanced/advanced.php +++ b/core/module/config/view/advanced/advanced.php @@ -103,7 +103,7 @@
$this->getData(['config', 'fileBackup']), + 'checked' => file_exists('site/data/.backup'), 'help' => '

Un fichier .backup.json est généré à chaque édition ou effacement d\'une donnée. La désactivation entraîne la suppression de ces fichiers.

' ]); ?>
diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 3527fa2a..c6ef26dd 100755 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -4,7 +4,6 @@ class init extends common { 'config' => [ 'analyticsId' => '', 'autoBackup' => true, - 'fileBackup' => true, 'autoUpdate' => true, 'autoUpdateHtaccess' => false, 'cookieConsent' => true, From f22eda7e6d1b8f00dc390ac25d4347901720a5c2 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 8 Jan 2021 10:49:31 +0100 Subject: [PATCH 4/7] Blog notification --- module/blog/blog.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/module/blog/blog.php b/module/blog/blog.php index 72331d3e..110d92f0 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -81,13 +81,13 @@ class blog extends common { public static $articleConsent = [ self::EDIT_ALL => 'Tous les groupes', self::EDIT_GROUP => 'Groupe du propriétaire', - self::EDIT_OWNER => 'Propiétaire' + self::EDIT_OWNER => 'Propriétaire' ]; public static $users = []; - const BLOG_VERSION = '4.1'; + const BLOG_VERSION = '4.2'; /** * Flux RSS @@ -627,22 +627,28 @@ class blog extends common { foreach($this->getData(['user']) as $userId => $user) { if ($user['group'] >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentGroupNotification']) ) { $to[] = $user['mail']; + $firstname[] = $user['firstname']; + $lastname[] = $user['lastname']; } } // Envoi du mail $sent code d'erreur ou de réussite $notification = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) === true ? 'Commentaire déposé en attente d\'approbation': 'Commentaire déposé'; if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentNotification']) === true) { - $sent = $this->sendMail( - $to, - 'Nouveau commentaire déposé', - 'Bonjour

' . - 'L\'article ' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . ' a reçu un nouveau commentaire.

', - '' - ); + $error = 0; + foreach($to as $key => $adress){ + $sent = $this->sendMail( + $adress, + 'Nouveau commentaire déposé', + 'Bonjour' . ' ' . $firstname[$key] . ' ' . $lastname[$key] . ',

' . + 'L\'article ' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . ' a reçu un nouveau commentaire.

', + '' + ); + if( $sent === false) $error++; + } // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl() . '#comment', - 'notification' => ($sent === true ? $notification . '
Une notification a été envoyée.' : $notification . '
Erreur de notification : ' . $sent), + 'notification' => ($error === 0 ? $notification . '
Une notification a été envoyée.' : $notification . '
Erreur de notification : ' . $sent), 'state' => ($sent === true ? true : null) ]); From 78e6dd7adc85277663a23df191451dc3d9cfc395 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 8 Jan 2021 15:13:16 +0100 Subject: [PATCH 5/7] Remove Facebook fbclid --- core/core.js.php | 7 +++++++ core/core.php | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/core/core.js.php b/core/core.js.php index be5c6b9d..09bfb0dd 100755 --- a/core/core.js.php +++ b/core/core.js.php @@ -472,4 +472,11 @@ $(document).ready(function(){ $(changeIcon).addClass('zwiico-menu'); }; }); + + /** + * Remove ID Facebook from URL + */ + if(/^\?fbclid=/.test(location.search)) + location.replace(location.href.replace(/\?fbclid.+/, "")); + }); diff --git a/core/core.php b/core/core.php index 738b4fa8..95995258 100755 --- a/core/core.php +++ b/core/core.php @@ -561,7 +561,16 @@ class common { // Une partie de l'url else { $url = explode('/', $this->url); - return array_key_exists($key, $url) ? $url[$key] : null; + 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; } } From d6f97b03bba278cb6b8a1e8ca452efd8e43ad31a Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 8 Jan 2021 15:21:15 +0100 Subject: [PATCH 6/7] =?UTF-8?q?fbclid=20dans=20htaccess=20avec=20la=20r?= =?UTF-8?q?=C3=A9=C3=A9criture?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/module/config/config.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/module/config/config.php b/core/module/config/config.php index 85f34738..9da3c94f 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -552,6 +552,8 @@ 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 . From 2ad68ca01da11e252c7a91e875466c7498792ca7 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 9 Jan 2021 11:32:44 +0100 Subject: [PATCH 7/7] 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 (