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/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.js.php b/core/core.js.php index 12d5f08b..9667595b 100755 --- a/core/core.js.php +++ b/core/core.js.php @@ -480,4 +480,10 @@ $(document).ready(function(){ $(".helpDisplayContent").slideToggle(); }); + /** + * 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 67f40757..7e95d295 100755 --- a/core/core.php +++ b/core/core.php @@ -209,7 +209,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') ]);; } @@ -554,7 +554,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; } } @@ -1934,7 +1943,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 ( diff --git a/core/module/config/config.php b/core/module/config/config.php index 355e9393..9da3c94f 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'), @@ -535,6 +534,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 === []) { @@ -550,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 . 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 1ac23fe1..7b02a767 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, diff --git a/module/blog/blog.php b/module/blog/blog.php index 5cb40fb2..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' . ' ' . $user['firstname'] . ' ' . $user['lastname'] . ',

' . - '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) ]);