From 19825afe2db2082098ae0c768bf80a564a1e8ef6 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Tue, 16 Feb 2021 09:44:04 +0100 Subject: [PATCH] 10.4.03 petites corrections --- CHANGES.md | 7 + README.md | 2 +- core/core.php | 31 +-- core/layout/main.php | 5 +- core/module/config/config.php | 28 +-- module/blog/view/article/article.php | 282 +++++++++++++-------------- module/blog/view/index/index.php | 2 - 7 files changed, 176 insertions(+), 181 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 028c8565..3857a8e6 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,12 @@ # Changelog +## version 10.4.03 +- Corrections : + - En-tête html : absence de la langue. + - Suppression de la balise sémantique
. + - Génération image Opengraph, mauvaise redirection. + - Nouvelle structure de données articles de blog dans le sitemap. + ## version 10.4.02 - Corrections : - Thème : aperçu du site amélioré. diff --git a/README.md b/README.md index cb9d1c5f..487b18c0 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# ZwiiCMS 10.4.02 +# ZwiiCMS 10.4.03 Zwii est un CMS sans base de données (flat-file) qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation. diff --git a/core/core.php b/core/core.php index e0602d7c..17cf9ca2 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.02'; + const ZWII_VERSION = '10.4.03'; const ZWII_UPDATE_CHANNEL = "v10"; public static $actions = []; @@ -603,7 +603,7 @@ class common { $this->setData(['theme',$tempData['theme']]); // Import des users sauvegardés si option active - if ($keepUsers === false + if ($keepUsers === false AND $tempData['user'] !== NULL) { $this->setData(['user',$tempData['user']]); } @@ -766,6 +766,16 @@ class common { if ($this->getData(['page', $parentPageId, 'disable']) !== true ) { $sitemap->addUrl ($parentPageId,$datetime); } + // Articles du blog + if ($this->getData(['page', $parentPageId, 'moduleId']) === 'blog' && + !empty($this->getData(['module',$parentPageId])) ) { + foreach($this->getData(['module',$parentPageId,'posts']) as $articleId => $article) { + if($this->getData(['module',$parentPageId,'posts',$articleId,'state']) === true) { + $date = $this->getData(['module',$parentPageId,'posts',$articleId,'publishedOn']); + $sitemap->addUrl( $parentPageId . '/' . $articleId , new DateTime("@{$date}",new DateTimeZone($timezone))); + } + } + } // Sous-pages foreach($childrenPageIds as $childKey) { if ($this->getData(['page',$childKey,'group']) !== 0 || $this->getData(['page', $childKey, 'disable']) === true) { @@ -776,24 +786,15 @@ class common { // La sous-page est un blog if ($this->getData(['page', $childKey, 'moduleId']) === 'blog' && !empty($this->getData(['module',$childKey])) ) { - foreach($this->getData(['module',$childKey]) as $articleId => $article) { - if($this->getData(['module',$childKey,$articleId,'state']) === true) { - $date = $this->getData(['module',$childKey,$articleId,'publishedOn']); + foreach($this->getData(['module',$childKey,'posts']) as $articleId => $article) { + if($this->getData(['module',$childKey,'posts',$articleId,'state']) === true) { + $date = $this->getData(['module',$childKey,'posts',$articleId,'publishedOn']); $sitemap->addUrl( $childKey . '/' . $articleId , new DateTime("@{$date}",new DateTimeZone($timezone))); } } } } - // Articles du blog - if ($this->getData(['page', $parentPageId, 'moduleId']) === 'blog' && - !empty($this->getData(['module',$parentPageId])) ) { - foreach($this->getData(['module',$parentPageId]) as $articleId => $article) { - if($this->getData(['module',$parentPageId,$articleId,'state']) === true) { - $date = $this->getData(['module',$parentPageId,$articleId,'publishedOn']); - $sitemap->addUrl( $parentPageId . '/' . $articleId , new DateTime("@{$date}",new DateTimeZone($timezone))); - } - } - } + } // generating internally a sitemap diff --git a/core/layout/main.php b/core/layout/main.php index fb3eacfb..1f19cbc4 100755 --- a/core/layout/main.php +++ b/core/layout/main.php @@ -1,7 +1,6 @@ - + - + diff --git a/core/module/config/config.php b/core/module/config/config.php index 85f34738..a1932ca1 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -286,16 +286,20 @@ class config extends common { $data = str_replace('_','/',$googlePagespeedData['lighthouseResult']['audits']['final-screenshot']['details']['data']); $data = str_replace('-','+',$data); $img = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data)); - $success = file_put_contents( self::FILE_DIR.'source/screenshot.jpg',$img) ; - // Effacer la miniature png - if (file_exists(self::FILE_DIR.'source/screenshot.png')) { - unlink (self::FILE_DIR.'source/screenshot.png'); + // Effacer l'image et la miniature png + if (file_exists(self::FILE_DIR.'thumb/screenshot.jpg')) { + unlink (self::FILE_DIR.'thumb/screenshot.jpg'); } + if (file_exists(self::FILE_DIR.'source/screenshot.jpg')) { + unlink (self::FILE_DIR.'source/screenshot.jpg'); + } + $success = file_put_contents( self::FILE_DIR.'source/screenshot.jpg',$img) ; + } // Valeurs en sortie $this->addOutput([ 'notification' => $success === false ? 'Service inaccessible ou erreur d\'écriture de l\'image' : 'Image générée avec succès', - 'redirect' => helper::baseUrl() . 'advanced', + 'redirect' => helper::baseUrl() . 'config/advanced', 'state' => $success === false ? false : true ]); } @@ -376,13 +380,6 @@ class config extends common { $this->getInput('configManageImportUser', helper::FILTER_BOOLEAN) === true) { $this->setData(['user',$users]); } - /* - if ($version === '9' ) { - $this->importData($this->getInput('configManageImportUser', helper::FILTER_BOOLEAN)); - $this->setData(['core','dataVersion',0]); - }*/ - - // Met à jours les URL dans les contenus de page // Message de notification $notification = $success === true ? 'Restauration réalisée avec succès' : 'Erreur inconnue'; @@ -453,12 +450,7 @@ class config extends common { 'state' => $success ]); } - // Initialisation du screen - APPEL AUTO DESACTIVE POUR EVITER UN RALENTISSEMENT - /* - if (!file_exists(self::FILE_DIR.'source/screenshot.jpg')) { - $this->configMetaImage(); - } - */ + // Valeurs en sortie $this->addOutput([ 'title' => 'Configuration', diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index 7016c91c..6706ffa4 100755 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -1,154 +1,152 @@ -
-
-
-
- - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); - echo $date . ' à ' . $heure; - ?> -
-
-
- getUser('password') === $this->getInput('ZWII_USER_PASSWORD') - AND - ( // Propriétaire - ( - $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER - AND ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'userId']) === $this->getUser('id') - OR $this->getUser('group') === self::GROUP_ADMIN ) - ) - OR ( - // Groupe - ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN - OR $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR) - AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) - ) - OR ( - // Tout le monde - $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL - AND $this->getUser('group') >= $module::$actions['config'] - ) - ) - ): ?> - helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'], - 'value' => 'Editer' - ]); ?> - +
+
+
+ + getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) + ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) + : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); + $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) + ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) + : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); + echo $date . ' à ' . $heure; + ?>
- getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?> - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) == false) { - echo '' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . ''; - } ?> - getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?> -

- - getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?> - - - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?> -

Cet article ne reçoit pas de commentaire.

- -

- - - - 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?> -

- - 'Rédiger un commentaire...', - 'readonly' => true - ]); ?> -
- getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?> - 'Nom', - 'readonly' => true, - 'value' => $module::$editCommentSignature - ]); ?> - $this->getUser('id') - ]); ?> - -
-
- 'Nom' - ]); ?> -
-
-
Ou
-
-
- helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment', - 'value' => 'Connexion' - ]); ?> -
-
- - 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']).' caractères', - 'class' => 'editorWysiwygComment', - 'noDirty' => true, - 'maxlength' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']) +
+ getUser('password') === $this->getInput('ZWII_USER_PASSWORD') + AND + ( // Propriétaire + ( + $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER + AND ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'userId']) === $this->getUser('id') + OR $this->getUser('group') === self::GROUP_ADMIN ) + ) + OR ( + // Groupe + ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN + OR $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR) + AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) + ) + OR ( + // Tout le monde + $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL + AND $this->getUser('group') >= $module::$actions['config'] + ) + ) + ): ?> + helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'], + 'value' => 'Editer' ]); ?> -
- getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?> -
-
- $this->getData(['config','captchaStrong']) - ]); ?> -
-
- + +
+
+ getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?> + getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) == false) { + echo '' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . ''; + } ?> +getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?> +

+ +getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?> + + +getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?> +

Cet article ne reçoit pas de commentaire.

+ +

+ + + + 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?> +

+ + 'Rédiger un commentaire...', + 'readonly' => true + ]); ?> +
+ getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?> + 'Nom', + 'readonly' => true, + 'value' => $module::$editCommentSignature + ]); ?> + $this->getUser('id') + ]); ?> +
-
- 'buttonGrey', - 'value' => 'Annuler' +
+ 'Nom' ]); ?>
-
- 'Envoyer', - 'ico' => '' +
+
Ou
+
+
+ helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment', + 'value' => 'Connexion' ]); ?>
+ + 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']).' caractères', + 'class' => 'editorWysiwygComment', + 'noDirty' => true, + 'maxlength' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']) + ]); ?> +
+ getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?> +
+
+ $this->getData(['config','captchaStrong']) + ]); ?> +
+
+ +
+
+ 'buttonGrey', + 'value' => 'Annuler' + ]); ?> +
+
+ 'Envoyer', + 'ico' => '' + ]); ?> +
- -
-
- $comment): ?> -
-

- le - -

-
+ +
+
+ $comment): ?> +
+

+ le + +

+
- -
\ No newline at end of file + + \ No newline at end of file diff --git a/module/blog/view/index/index.php b/module/blog/view/index/index.php index 1434d5b7..ca0f24d7 100755 --- a/module/blog/view/index/index.php +++ b/module/blog/view/index/index.php @@ -21,7 +21,6 @@