diff --git a/.gitignore b/.gitignore index 7efe5ebc..dea6cb7e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +<<<<<<< HEAD # Fichiers temporaires site/tmp/* @@ -10,9 +11,19 @@ site/data/* # Fichiers uploadés site/file/source/* site/file/thumb/* +======= +# Fichiers de données +site/* +>>>>>>> 8.3.14 # Dossiers vides dans GitHub !.gitkeep # PHPStorm .idea/ +<<<<<<< HEAD +======= + +#Visual Code +.vscode +>>>>>>> 8.3.14 diff --git a/.htaccess b/.htaccess index 2ce745a5..eecb7f01 100755 --- a/.htaccess +++ b/.htaccess @@ -4,4 +4,29 @@ SetEnv SESSION_USE_TRANS_SID 0 # Bloque l'accès à la liste des fichiers Options -Indexes -# Attention, surtout ne rien modifier ci-dessous ! \ No newline at end of file +<<<<<<< HEAD +# Attention, surtout ne rien modifier ci-dessous ! +======= +# Attention, surtout ne rien modifier ci-dessous ! + + RewriteEngine on + RewriteBase /ZwiiCMS-dev/ + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)$ index.php?$1 [L] + + + RewriteEngine on + RewriteBase /ZwiiCMS-dev/ + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)$ index.php?$1 [L] + + + RewriteEngine on + RewriteBase /ZwiiCMS-dev/ + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)$ index.php?$1 [L] + +>>>>>>> 8.3.14 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/CHANGES.MD b/CHANGES.MD index 192db4a3..bace6514 100644 --- a/CHANGES.MD +++ b/CHANGES.MD @@ -1,12 +1,32 @@ -# ChangeLog +# ChangeLog -## Préversion 8.3.13 : +## Version 8.4.0 +* Modifications : + - Footer dans 3 blocs contenant dans l'ordre : Texte, Réseaux sociaux, Copyright + - Pagination variable du nombres d'articles par page (news, blog et form) + - Position des modules Galerie et Form dans une page ; haut ; bas ou libre avec les doubles crochets insérés dans l'article [] (PeterRabbit) + - Prise en compte des balises OpenGraph obligatoires title , description, type et images + - Modification de la position des boutons retour et éditer lors de l'affichage d'un article si connecté + - Mise en forme de la composition des articles et des news + - Suppression du message de l'édition des redirections + - Modifications de la présentation des en-têtes d'articles de Blog et de News + - Format du mois au format long et en français +* Correction : + - Accès aux pages désactivées par le sitemap + - Réduction du temps d'affichage des notifications + - Image responsive en en-tête de l'article d'un blog + - Mise à jour du gestionnaire de fichiers en version 9.13.1 + +## version 8.3.13 : * Modifications : - Bannière "responsive", nouvelles options de positionnement - Bouton Edit dans Blog - Options de position des menus selon la position de la bannière - - Mise à jour TinyMCE + - Bouton Edition dans un article du blog + - Balise ALT dans les images du menu + - Correction RFM + ## version 8.3.12 : * Modification : diff --git a/README.md b/README.md index 6cbf5285..cbf95a94 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ Zwii est un CMS sans base de données (Flat-File) qui permet à ses utilisateurs de créer et gérer facilement un site web sans aucune connaissance en programmation. -[Site](http://zwiicms.com/) - [Forum](http://forum.zwiicms.com/) - [GitHub](https://github.com/remijean/ZwiiCMS/) +[Site](http://zwiicms.com/) - [Forum](http://forum.zwiicms.com/) - [GitHub version initiale](https://github.com/remijean/ZwiiCMS/) - [GitHub](https://github.com/fredtempez/ZwiiCMS) + +Zwii a été créé par un développeur de talent, [Rémi Jean](https://remijean.fr/), il est désormais maintenu par la communauté et hébergé sur ce git. ## Configuration recommandée diff --git a/core/core.php b/core/core.php index faf2e122..03d9faa9 100644 --- a/core/core.php +++ b/core/core.php @@ -24,7 +24,7 @@ class common { const GROUP_MEMBER = 1; const GROUP_MODERATOR = 2; const GROUP_ADMIN = 3; - const ZWII_VERSION = '8.3.13'; + const ZWII_VERSION = '8.4.0'; public static $actions = []; public static $coreModuleIds = [ @@ -55,7 +55,8 @@ class common { 'youtubeId' => '' ], 'timezone' => 'Europe/Paris', - 'title' => 'Zwii, votre site en quelques clics !' + 'title' => 'Zwii, votre site en quelques clics !', + 'ItemsperPage' => 10 ], 'core' => [ 'dataVersion' => 0, @@ -74,6 +75,7 @@ class common { 'metaDescription' => '', 'metaTitle' => '', 'moduleId' => '', + 'modulePosition' => 'bottom', 'parentPageId' => '', 'position' => 1, 'group' => self::GROUP_VISITOR, @@ -91,6 +93,7 @@ class common { 'metaDescription' => '', 'metaTitle' => '', 'moduleId' => '', + 'modulePosition' => 'bottom', 'parentPageId' => 'accueil', 'position' => 1, 'group' => self::GROUP_VISITOR, @@ -109,6 +112,7 @@ class common { 'metaTitle' => '', 'moduleId' => '', 'parentPageId' => '', + 'modulePosition' => 'bottom', 'position' => 2, 'group' => self::GROUP_MEMBER, 'targetBlank' => false, @@ -124,6 +128,7 @@ class common { 'metaDescription' => '', 'metaTitle' => '', 'moduleId' => 'blog', + 'modulePosition' => 'bottom', 'parentPageId' => '', 'position' => 3, 'group' => self::GROUP_VISITOR, @@ -141,6 +146,7 @@ class common { 'metaDescription' => '', 'metaTitle' => '', 'moduleId' => 'gallery', + 'modulePosition' => 'bottom', 'parentPageId' => '', 'position' => 4, 'group' => self::GROUP_VISITOR, @@ -158,6 +164,7 @@ class common { 'metaDescription' => '', 'metaTitle' => '', 'moduleId' => 'redirection', + 'modulePosition' => 'bottom', 'parentPageId' => '', 'position' => 5, 'group' => self::GROUP_VISITOR, @@ -175,6 +182,7 @@ class common { 'metaDescription' => '', 'metaTitle' => '', 'moduleId' => 'form', + 'modulePosition' => 'bottom', 'parentPageId' => '', 'position' => 6, 'group' => self::GROUP_VISITOR, @@ -307,7 +315,10 @@ class common { 'socialsAlign' => 'center', 'text' => '', 'textAlign' => 'center', - 'textColor' => 'rgba(33, 34, 35, 1)' + 'textColor' => 'rgba(33, 34, 35, 1)', + 'copyrightPosition' => '3', + 'textPosition' => '2', + 'socialsPosition' => '1' ], 'header' => [ 'backgroundColor' => 'rgba(255, 255, 255, 1)', @@ -589,6 +600,27 @@ class common { } } + /** + * Récupérer une copie d'écran du site Web pour le tag image si le fichier n'existe pas + * En local, copie du site décran de ZwiiCMS + */ + public function makeImageTag () { + if (!file_exists('site/file/source/screenshot.png')) + { + if ( strpos(helper::baseUrl(false),'localhost') > 0 OR strpos(helper::baseUrl(false),'127.0.0.1') > 0) { + $site = 'https://ZwiiCMS.com'; } else { + $site = helper::baseUrl(false); } + + $googlePagespeedData = file_get_contents('https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url='. $site .'&screenshot=true'); + $googlePagespeedData = json_decode($googlePagespeedData, true); + $screenshot = $googlePagespeedData['screenshot']['data']; + $screenshot = str_replace(array('_','-'),array('/','+'),$screenshot); + $data = 'data:image/jpeg;base64,'.$screenshot; + $data = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data)); + file_put_contents( 'site/file/source/screenshot.png',$data); + } + } + /** * Accède aux données * @param array $keys Clé(s) des données @@ -865,8 +897,17 @@ class common { $this->setData(['theme','header','imageContainer','auto']); $this->setData(['core', 'dataVersion', 8313]); $this->SaveData(); - } + // Version 8.4.0 + if($this->getData(['core', 'dataVersion']) < 840) { + $this->setData(['theme','footer','socialsPosition','1']); + $this->setData(['theme','footer','textPosition','2']); + $this->setData(['theme','footer','copyrightPosition','3']); + $this->setData(['config','ItemsperPage','10']); + $this->setData(['core', 'dataVersion', 840]); + $this->SaveData(); + } + } } @@ -1251,11 +1292,24 @@ class core extends common { if(file_exists($viewPath)) { ob_start(); include $viewPath; - $this->addOutput([ - 'content' => ($output['showPageContent'] ? $pageContent : '') . ob_get_clean() - ]); + $modpos = $this->getData(['page', $this->getUrl(0), 'modulePosition']); + if ($modpos === 'top') { + $this->addOutput([ + 'content' => ob_get_clean() . ($output['showPageContent'] ? $pageContent : '')]); + } + else if ($modpos === 'free') { + $begin = strstr($pageContent, '[]', true); + $end = strstr($pageContent, '[]'); + $cut=2; + $end=substr($end,-strlen($end)+$cut); + $this->addOutput([ + 'content' => ($output['showPageContent'] ? $begin : '') . ob_get_clean() . ($output['showPageContent'] ? $end : '')]); } + else { + $this->addOutput([ + 'content' => ($output['showPageContent'] ? $pageContent : '') . ob_get_clean()]); + } } - } + } // Librairies if($output['vendor'] !== $this->output['vendor']) { $this->addOutput([ @@ -1604,10 +1658,11 @@ class helper { * Crée un système de pagination (retourne un tableau contenant les informations sur la pagination (first, last, pages)) * @param array $array Tableau de donnée à utiliser * @param string $url URL à utiliser, la dernière partie doit correspondre au numéro de page, par défaut utiliser $this->getUrl() + * @param string $item pagination nombre d'éléments par page * @param null|int $sufix Suffixe de l'url * @return array */ - public static function pagination($array, $url, $sufix = null) { + public static function pagination($array, $url, $item, $sufix = null) { // Scinde l'url $url = explode('/', $url); // Url de pagination @@ -1617,13 +1672,13 @@ class helper { // Nombre d'éléments à afficher $nbElements = count($array); // Nombre de page - $nbPage = ceil($nbElements / 10); + $nbPage = ceil($nbElements / $item); // Page courante $currentPage = is_numeric($urlPagination) ? self::filter($urlPagination, self::FILTER_INT) : 1; // Premier élément de la page - $firstElement = ($currentPage - 1) * 10; + $firstElement = ($currentPage - 1) * $item; // Dernier élément de la page - $lastElement = $firstElement + 10; + $lastElement = $firstElement + $item; $lastElement = ($lastElement > $nbElements) ? $nbElements : $lastElement; // Mise en forme de la liste des pages $pages = ''; @@ -1827,30 +1882,30 @@ class layout extends common { break; case 'text' : $items .= $this->getData(['page', $parentPageId, 'title']); - break; + break; case 'icon' : if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { - $items .= ''; + $items .= ''.$this->getData(['page', $parentPageId, 'title']).''; } else { $items .= $this->getData(['page', $parentPageId, 'title']); } break; case 'icontitle' : if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { - $items .= 'getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .'site/file/source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" title="'; $items .= $this->getData(['page', $parentPageId, 'title']).'"/>'; } else { $items .= $this->getData(['page', $parentPageId, 'title']); - } + } break; case 'icontext' : if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { - $items .= ''; + $items .= ''.$this->getData(['page', $parentPageId, 'title']).''; $items .= $this->getData(['page', $parentPageId, 'title']); } else { $items .= $this->getData(['page', $parentPageId, 'title']); } - break; + break; } // Menu Image @@ -1885,30 +1940,30 @@ class layout extends common { break; case 'text' : $items .= $this->getData(['page', $childKey, 'title']); - break; + break; case 'icon' : if ($this->getData(['page', $childKey, 'iconUrl']) != "") { - $items .= ''; + $items .= ''.$this->getData(['page', $parentPageId, 'title']).''; } else { $items .= $this->getData(['page', $parentPageId, 'title']); } break; case 'icontitle' : if ($this->getData(['page', $childKey, 'iconUrl']) != "") { - $items .= 'getData(['page', $parentPageId, 'title']).'" src="'. helper::baseUrl(false) .'site/file/source/'.$this->getData(['page', $childKey, 'iconUrl']).'" title="'; $items .= $this->getData(['page', $childKey, 'title']).'"/>'; } else { $items .= $this->getData(['page', $childKey, 'title']); - } + } break; case 'icontext' : if ($this->getData(['page', $childKey, 'iconUrl']) != "") { - $items .= ''; + $items .= ''.$this->getData(['page', $parentPageId, 'title']).''; $items .= $this->getData(['page', $childKey, 'title']); } else { $items .= $this->getData(['page', $childKey, 'title']); } - break; + break; } $items .= ''; // Menu Image @@ -1937,15 +1992,33 @@ class layout extends common { */ public function showMetaTitle() { echo '' . $this->core->output['metaTitle'] . ''; + echo ''; } /** * Affiche la meta description */ public function showMetaDescription() { - echo ''; + echo ''; + echo ''; } + /** + * Affiche le meta type + */ + public function showMetaType() { + echo ''; + } + + /** + * Affiche la meta image (site screenshot) + */ + public function showMetaImage() { + echo ''; + } + + + /** * Affiche la notification */ diff --git a/core/layout/blank.php b/core/layout/blank.php index 96285a5a..63bfd4e1 100755 --- a/core/layout/blank.php +++ b/core/layout/blank.php @@ -1,11 +1,13 @@ - + showMetaTitle(); ?> showMetaDescription(); ?> + showMetaType(); ?> + showMetaImage(); ?> showFavicon(); ?> showVendor(); ?> diff --git a/core/layout/common.css b/core/layout/common.css index 89d14300..9ac112fb 100755 --- a/core/layout/common.css +++ b/core/layout/common.css @@ -305,6 +305,11 @@ header .container { body > nav { margin: 0 -10px; } +/* Items du menu */ +nav a > img { + margin: -4px 0; + vertical-align: middle; + } nav #toggle { cursor: pointer; text-align: right; @@ -398,9 +403,15 @@ footer { text-align: center; font-size: .8em; padding: 10px 20px; + vertical-align:middle; } + +footer .col4 { + vertical-align: middle; +} + footer #footerSocials { - font-size: 1.6em; + font-size: 1.0em; } footer #footerSocials span { color: #FFF; diff --git a/core/layout/light.php b/core/layout/light.php index 61e6ec39..b4ce9a88 100755 --- a/core/layout/light.php +++ b/core/layout/light.php @@ -1,11 +1,13 @@ - + showMetaTitle(); ?> showMetaDescription(); ?> + showMetaType(); ?> + showMetaImage(); ?> showFavicon(); ?> showVendor(); ?> diff --git a/core/layout/main.php b/core/layout/main.php index bf482ce2..fd3cd7dc 100755 --- a/core/layout/main.php +++ b/core/layout/main.php @@ -1,11 +1,13 @@ - + showMetaTitle(); ?> showMetaDescription(); ?> + showMetaType(); ?> + showMetaImage(); ?> showFavicon(); ?> showVendor(); ?> @@ -135,11 +137,53 @@ ) ): ?> + @@ -147,10 +191,51 @@ getData(['theme', 'footer', 'position']) === 'body'): ?> diff --git a/core/module/config/config.php b/core/module/config/config.php index 00f2b304..bc7ced0b 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -134,11 +134,20 @@ class config extends common { 'Pacific/Fiji' => '(GMT+12:00) Fiji', 'Asia/Kamchatka' => '(GMT+12:00) Kamchatka' ]; + // Nombre d'objets par page + public static $ItemsList = [ + 5 => '5 articles', + 10 => '10 articles', + 15 => '15 articles', + 20 => '20 articles' + ]; + /** * Sauvegarde des données */ public function backup() { + // Creation du ZIP $fileName = date('Y-m-d-h-i-s', time()) . '.zip'; $zip = new ZipArchive(); @@ -159,6 +168,34 @@ class config extends common { ]); } + /** + * Réalise une copie d'écran + * https://www.codexworld.com/capture-screenshot-website-url-php-google-api/ + */ + public function configmetaimage() { + // fonction désactivée pour un site local + if ( strpos(helper::baseUrl(false),'localhost') > 0 OR strpos(helper::baseUrl(false),'127.0.0.1') > 0) { + $site = 'https://ZwiiCMS.com'; } else { + $site = helper::baseUrl(false); } + + $googlePagespeedData = file_get_contents('https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url='. $site .'&screenshot=true&key=AIzaSyA_JOJidlWFgEiyxTlSGi2_fORgYsCZFtA'); + $googlePagespeedData = json_decode($googlePagespeedData, true); + $screenshot = $googlePagespeedData['screenshot']['data']; + $screenshot = str_replace(array('_','-'),array('/','+'),$screenshot); + $data = 'data:image/jpeg;base64,'.$screenshot; + $data = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data)); + file_put_contents( 'site/file/source/screenshot.png',$data); + + // Valeurs en sortie + $this->addOutput([ + 'notification' => 'Image tag réinitialisée', + 'redirect' => helper::baseUrl() . 'config', + 'state' => true + ]); + } + + + /** * Configuration */ @@ -184,7 +221,8 @@ class config extends common { 'youtubeId' => $this->getInput('configSocialYoutubeId') ], 'timezone' => $this->getInput('configTimezone', helper::FILTER_STRING_SHORT, true), - 'title' => $this->getInput('configTitle', helper::FILTER_STRING_SHORT, true) + 'title' => $this->getInput('configTitle', helper::FILTER_STRING_SHORT, true), + 'ItemsperPage' => $this->getInput('ItemsperPage') ] ]); if(self::$inputNotices === []) { diff --git a/core/module/config/view/index/index.php b/core/module/config/view/index/index.php index b650eb30..704eb23b 100755 --- a/core/module/config/view/index/index.php +++ b/core/module/config/view/index/index.php @@ -1,3 +1,4 @@ +makeImageTag(); ?>
@@ -16,18 +17,22 @@

Informations générales

- 'Titre du site', - 'value' => $this->getData(['config', 'title']) - ]); ?> - 'Description du site', - 'value' => $this->getData(['config', 'metaDescription']) - ]); ?> + getData(['page']), 'title', 'SORT_ASC'), [ 'label' => 'Page d\'accueil', 'selected' => $this->getData(['config', 'homePageId']) ]); ?> + + 'Titre du site', + 'value' => $this->getData(['config', 'title']), + 'help' => 'Affiché dans la barre de titre et inclus lors des partages sur les réseaux sociaux' + ]); ?> + 'Description du site', + 'value' => $this->getData(['config', 'metaDescription']), + 'help' => 'La description est incluse lors des partages sur les réseaux sociaux' + ]); ?>

Options avancées

@@ -45,11 +50,18 @@ ]); ?> $this->getData(['config', 'cookieConsent']) - ]); ?> + ]); ?> helper::checkRewrite(), 'help' => 'Afin d\'éviter de bloquer votre site pensez à vérifier que le module de réécriture d\'URL est bien actif sur votre serveur avant d\'activer cette fonctionnalité.' ]); ?> + + + 'Pagination Blog et News', + 'selected' => $this->getData(['config', 'ItemsperPage']), + 'help' => 'Nombre d\'articles de blog ou de news par page' + ]); ?>
@@ -132,6 +144,24 @@
+
+

Copie d'écran pour OpenGraph :

+
+ +
+
+

' /> +

+
+
+

Cette copie d'écran est nécessaire aux partages sur les réseaux sociaux. Elle est régénérée lorsque le fichier screenshot.png est effacé du gestionnaire de fichiers.

+
diff --git a/core/module/page/page.php b/core/module/page/page.php index 454dc549..7a723e9d 100755 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -32,7 +32,12 @@ class page extends common { 'icontext' => 'Icône et texte' ]; // menu image - + // Position du module + public static $modulePosition = [ + 'bottom' => 'En bas', + 'top' => 'En haut', + 'free' => 'Libre' + ]; /** * Création */ @@ -54,6 +59,7 @@ class page extends common { 'metaTitle' => '', 'moduleId' => '', 'parentPageId' => '', + 'modulePosition' => 'bottom', 'position' => 0, 'group' => self::GROUP_VISITOR, 'targetBlank' => false, @@ -183,6 +189,7 @@ class page extends common { 'metaDescription' => $this->getInput('pageEditMetaDescription', helper::FILTER_STRING_LONG), 'metaTitle' => $this->getInput('pageEditMetaTitle'), 'moduleId' => $this->getInput('pageEditModuleId'), + 'modulePosition' => $this->getInput('configModulePosition'), 'parentPageId' => $this->getInput('pageEditParentPageId'), 'position' => $position, 'group' => $this->getInput('pageEditGroup', helper::FILTER_INT), diff --git a/core/module/page/view/edit/edit.php b/core/module/page/view/edit/edit.php index 88268409..0a94e11e 100755 --- a/core/module/page/view/edit/edit.php +++ b/core/module/page/view/edit/edit.php @@ -128,6 +128,13 @@ 'maxlength' => '500', 'value' => $this->getData(['page', $this->getUrl(2), 'metaDescription']) ]); ?> + getData(['page', $this->getUrl(2), 'moduleId']) === 'form') or ($this->getData(['page', $this->getUrl(2), 'moduleId']) === 'gallery')) { + echo template::select('configModulePosition', $module::$modulePosition,[ + 'help' => 'En position libre ajoutez manuellement le module en plaçant deux crochets [] à l\'endroit voulu dans votre page.', + 'label' => 'Position du module dans la page', + 'selected' => $this->getData(['page', $this->getUrl(2), 'modulePosition']) + ]); + } ?> $this->getData(['page', $this->getUrl(2), 'hideTitle']) ]); ?> diff --git a/core/module/sitemap/view/index/index.php b/core/module/sitemap/view/index/index.php index c6223054..290a5544 100755 --- a/core/module/sitemap/view/index/index.php +++ b/core/module/sitemap/view/index/index.php @@ -1,11 +1,17 @@