diff --git a/CHANGES.md b/CHANGES.md index ce000e36..ab8f3fbf 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,21 @@ # Changelog +## Version 12.3.04 +### Corrections +- Corrige un défaut d'actualisation de la liste des pages et du site map lorsque la page change d'id. +- Serveur SMTP : + - Corrige le décryptage du mot de passe SMTP. + - Corrige un défaut d'encodage UTF-8 du sujet du mail et du titre du site. +- Traduction du message de compte bloqué. +### Améliorations +- Module Blog : + - Aspect de la liste des articles présenté en tableau avec un bouton "Lire la suite" agrémenté d'un effet de flou. + - Des tailles de masquage du texte des articles plus importantes sont proposées. +- Comptes de réseaux sociaux : + - Sont ajoutés Steam, Twitch, Vimeo et Reddit. + - Des icônes accompagnent le noms des réseaux dans la configuration. + + ## Version 12.3.03 - Corrige le problème d'affichage lors de l'édition d'une page contenant une feuille style commentée. - Corrige des problèmes d'interprétation des scripts intégrés dans une page. diff --git a/LISEZMOI.md b/LISEZMOI.md index fdfcb7b2..8168338a 100644 --- a/LISEZMOI.md +++ b/LISEZMOI.md @@ -1,4 +1,4 @@ -# ZwiiCMS 12.3.03 +# ZwiiCMS 12.3.04 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/README.md b/README.md index b7374707..07186ec7 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ZwiiCMS 12.3.03 +# ZwiiCMS 12.3.04 Zwii is a database-less (flat-file) CMS that allows you to easily create and manage a web site without any programming knowledge. diff --git a/core/class/helper.class.php b/core/class/helper.class.php index eee6825a..a2ade945 100644 --- a/core/class/helper.class.php +++ b/core/class/helper.class.php @@ -688,25 +688,23 @@ class helper /** * Cryptage * @param string $key la clé d'encryptage - * @param string $payload la chaine à coder + * @param string $string la chaine à coder * @return string */ - public static function encrypt($key, $payload) - { - $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc')); - $encrypted = openssl_encrypt($payload, 'aes-256-cbc', $key, 0, $iv); - return base64_encode($encrypted . '::' . $iv); - } + public static function encrypt($string, $key) { + $encrypted = openssl_encrypt($string, "AES-256-CBC", $key, 0, substr(md5($key), 0, 16)); + return base64_encode($encrypted); + } /** * Décryptage * @param string $key la clé d'encryptage - * @param string $garble la chaine à décoder + * @param string $string la chaine à décoder * @return string */ - public static function decrypt($key, $garble) - { - list($encrypted_data, $iv) = explode('::', base64_decode($garble), 2); - return openssl_decrypt($encrypted_data, 'aes-256-cbc', $key, 0, $iv); - } -} \ No newline at end of file + public static function decrypt($string, $key) { + $decrypted = openssl_decrypt(base64_decode($string), "AES-256-CBC", $key, 0, substr(md5($key), 0, 16)); + return $decrypted; + } + +} diff --git a/core/class/layout.class.php b/core/class/layout.class.php index e2c10060..a60fa1cf 100644 --- a/core/class/layout.class.php +++ b/core/class/layout.class.php @@ -410,6 +410,22 @@ class layout extends common $socialUrl = 'https://www.github.com/'; $title = 'Github'; break; + case 'redditId': + $socialUrl = 'https://www.reddit.com/user/'; + $title = 'Reddit'; + break; + case 'twitchId': + $socialUrl = 'https://www.twitch.tv/'; + $title = 'Twitch'; + break; + case 'vimeoId': + $socialUrl = 'https://vimeo.com/'; + $title = 'Vimeo'; + break; + case 'steamId': + $socialUrl = 'https://steamcommunity.com/id/'; + $title = 'Steam'; + break; default: $socialUrl = ''; } @@ -965,7 +981,7 @@ class layout extends common 'help' => 'Fichiers', 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']), 'attr' => 'data-lity' - ]) . ''; + ]) . ''; } if ($this->getUser('group') >= self::GROUP_ADMIN) { $rightItems .= '
  • ' . template::ico('brush', [ @@ -1016,10 +1032,10 @@ class layout extends common } } if ($this->getUser('group') >= self::GROUP_MODERATOR) { - $rightItems .= '
  • ' . - template::ico('user', ['margin' => 'right']) . '' . $this->getUser('firstname') . ' ' . $this->getUser('lastname') . - '
  • '; + $rightItems .= '
  • ' . + template::ico('user', ['margin' => 'right']) . '' . $this->getUser('firstname') . ' ' . $this->getUser('lastname') . + '
  • '; } $rightItems .= '
  • ' . template::ico('logout', [ 'help' => 'Déconnecter', @@ -1043,8 +1059,8 @@ class layout extends common if ($this->core->output['inlineScript']) { $inlineScript = implode($this->core->output['inlineScript']); } - echo ''; - echo ''; + echo ''; + echo ''; } /** diff --git a/core/core.php b/core/core.php index fe216ccc..56642bc3 100644 --- a/core/core.php +++ b/core/core.php @@ -371,55 +371,10 @@ class common // Construit la liste des pages parents/enfants if ($this->hierarchy['all'] === []) { - $pages = helper::arrayColumn($this->getData(['page']), 'position', 'SORT_ASC'); - // Parents - foreach ($pages as $pageId => $pagePosition) { - if ( - // Page parent - $this->getData(['page', $pageId, 'parentPageId']) === "" - // Ignore les pages dont l'utilisateur n'a pas accès - and ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR - or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') - and $this->getUser('group') >= $this->getData(['page', $pageId, 'group']) - ) - ) - ) { - if ($pagePosition !== 0) { - $this->hierarchy['visible'][$pageId] = []; - } - if ($this->getData(['page', $pageId, 'block']) === 'bar') { - $this->hierarchy['bar'][$pageId] = []; - } - $this->hierarchy['all'][$pageId] = []; - } - } - // Enfants - foreach ($pages as $pageId => $pagePosition) { - if ( - // Page parent - $parentId = $this->getData(['page', $pageId, 'parentPageId']) - // Ignore les pages dont l'utilisateur n'a pas accès - and ( - ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR - and $this->getData(['page', $parentId, 'group']) === self::GROUP_VISITOR - ) - or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') - and $this->getUser('group') >= $this->getData(['page', $parentId, 'group']) - and $this->getUser('group') >= $this->getData(['page', $pageId, 'group']) - ) - ) - ) { - if ($pagePosition !== 0) { - $this->hierarchy['visible'][$parentId][] = $pageId; - } - if ($this->getData(['page', $pageId, 'block']) === 'bar') { - $this->hierarchy['bar'][$pageId] = []; - } - $this->hierarchy['all'][$parentId][] = $pageId; - } - } + $this->buildHierarchy(); } + // Construit l'url if ($this->url === '') { if ($url = $_SERVER['QUERY_STRING']) { @@ -707,6 +662,7 @@ class common } } + /** * Accède à la liste des pages parents et de leurs enfants * @param int $parentId Id de la page parent @@ -732,6 +688,133 @@ class common } } + /** + * Fonction pour construire le tableau des pages + * Appelée par le core uniquement + */ + + private function buildHierarchy() + { + + $pages = helper::arrayColumn($this->getData(['page']), 'position', 'SORT_ASC'); + // Parents + foreach ($pages as $pageId => $pagePosition) { + if ( + // Page parent + $this->getData(['page', $pageId, 'parentPageId']) === "" + // Ignore les pages dont l'utilisateur n'a pas accès + and ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR + or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') + and $this->getUser('group') >= $this->getData(['page', $pageId, 'group']) + ) + ) + ) { + if ($pagePosition !== 0) { + $this->hierarchy['visible'][$pageId] = []; + } + if ($this->getData(['page', $pageId, 'block']) === 'bar') { + $this->hierarchy['bar'][$pageId] = []; + } + $this->hierarchy['all'][$pageId] = []; + } + } + // Enfants + foreach ($pages as $pageId => $pagePosition) { + if ( + // Page parent + $parentId = $this->getData(['page', $pageId, 'parentPageId']) + // Ignore les pages dont l'utilisateur n'a pas accès + and ( + ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR + and $this->getData(['page', $parentId, 'group']) === self::GROUP_VISITOR + ) + or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') + and $this->getUser('group') >= $this->getData(['page', $parentId, 'group']) + and $this->getUser('group') >= $this->getData(['page', $pageId, 'group']) + ) + ) + ) { + if ($pagePosition !== 0) { + $this->hierarchy['visible'][$parentId][] = $pageId; + } + if ($this->getData(['page', $pageId, 'block']) === 'bar') { + $this->hierarchy['bar'][$pageId] = []; + } + $this->hierarchy['all'][$parentId][] = $pageId; + } + } + } + + /** + * Génère un fichier json avec la liste des pages + * + */ + private function tinyMcePages() + { + // Sauve la liste des pages pour TinyMCE + $parents = []; + $rewrite = (helper::checkRewrite()) ? '' : '?'; + // Boucle de recherche des pages actives + foreach ($this->getHierarchy(null, false, false) as $parentId => $childIds) { + $children = []; + // Exclure les barres + if ($this->getData(['page', $parentId, 'block']) !== 'bar') { + // Boucler sur les enfants et récupérer le tableau children avec la liste des enfants + foreach ($childIds as $childId) { + $children[] = [ + 'title' => ' » ' . html_entity_decode($this->getData(['page', $childId, 'shortTitle']), ENT_QUOTES), + 'value' => $rewrite . $childId + ]; + } + // Traitement + if (empty($childIds)) { + // Pas d'enfant, uniquement l'entrée du parent + $parents[] = [ + 'title' => html_entity_decode($this->getData(['page', $parentId, 'shortTitle']), ENT_QUOTES), + 'value' => $rewrite . $parentId + ]; + } else { + // Des enfants, on ajoute la page parent en premier + array_unshift($children, [ + 'title' => html_entity_decode($this->getData(['page', $parentId, 'shortTitle']), ENT_QUOTES), + 'value' => $rewrite . $parentId + ]); + // puis on ajoute les enfants au parent + $parents[] = [ + 'title' => html_entity_decode($this->getData(['page', $parentId, 'shortTitle']), ENT_QUOTES), + 'value' => $rewrite . $parentId, + 'menu' => $children + ]; + } + } + } + // Sitemap et Search + $children = []; + $children[] = [ + 'title' => 'Rechercher dans le site', + 'value' => $rewrite . 'search' + ]; + $children[] = [ + 'title' => 'Plan du site', + 'value' => $rewrite . 'sitemap' + ]; + $parents[] = [ + 'title' => 'Pages spéciales', + 'value' => '#', + 'menu' => $children + ]; + + // Enregistrement : 3 tentatives + for ($i = 0; $i < 3; $i++) { + if (file_put_contents('core/vendor/tinymce/link_list.json', json_encode($parents, JSON_UNESCAPED_UNICODE), LOCK_EX) !== false) { + break; + } + // Pause de 10 millisecondes + usleep(10000); + } + } + + /** * Accède à une valeur des variables http (ordre de recherche en l'absence de type : _COOKIE, _POST) * @param string $key Clé de la valeur @@ -837,74 +920,6 @@ class common return ($this->checkCSRF() and $this->input['_POST'] !== []); } - /** - * Génère un fichier json avec la liste des pages - * - */ - public function listPages() - { - // Sauve la liste des pages pour TinyMCE - $parents = []; - $rewrite = (helper::checkRewrite()) ? '' : '?'; - // Boucle de recherche des pages actives - foreach ($this->getHierarchy(null, false, false) as $parentId => $childIds) { - $children = []; - // Exclure les barres - if ($this->getData(['page', $parentId, 'block']) !== 'bar') { - // Boucler sur les enfants et récupérer le tableau children avec la liste des enfants - foreach ($childIds as $childId) { - $children[] = [ - 'title' => ' » ' . html_entity_decode($this->getData(['page', $childId, 'shortTitle']), ENT_QUOTES), - 'value' => $rewrite . $childId - ]; - } - // Traitement - if (empty($childIds)) { - // Pas d'enfant, uniquement l'entrée du parent - $parents[] = [ - 'title' => html_entity_decode($this->getData(['page', $parentId, 'shortTitle']), ENT_QUOTES), - 'value' => $rewrite . $parentId - ]; - } else { - // Des enfants, on ajoute la page parent en premier - array_unshift($children, [ - 'title' => html_entity_decode($this->getData(['page', $parentId, 'shortTitle']), ENT_QUOTES), - 'value' => $rewrite . $parentId - ]); - // puis on ajoute les enfants au parent - $parents[] = [ - 'title' => html_entity_decode($this->getData(['page', $parentId, 'shortTitle']), ENT_QUOTES), - 'value' => $rewrite . $parentId, - 'menu' => $children - ]; - } - } - } - // Sitemap et Search - $children = []; - $children[] = [ - 'title' => 'Rechercher dans le site', - 'value' => $rewrite . 'search' - ]; - $children[] = [ - 'title' => 'Plan du site', - 'value' => $rewrite . 'sitemap' - ]; - $parents[] = [ - 'title' => 'Pages spéciales', - 'value' => '#', - 'menu' => $children - ]; - - // Enregistrement : 3 tentatives - for ($i = 0; $i < 3; $i++) { - if (file_put_contents('core/vendor/tinymce/link_list.json', json_encode($parents), LOCK_EX) !== false) { - break; - } - // Pause de 10 millisecondes - usleep(10000); - } - } /** * Retourne une chemin localisé pour l'enregistrement des données @@ -931,14 +946,20 @@ class common /** * Génère un fichier un fichier sitemap.xml * https://github.com/icamys/php-sitemap-generator - * $command valeurs possible * all : génère un site map complet * Sinon contient id de la page à créer + * @param string Valeurs possibles */ - public function createSitemap($command = "all") + public function updateSitemap() { + // Rafraîchit la liste des pages après une modification de pageId notamment + $this->buildHierarchy(); + + // Actualise la liste des pages pour TinyMCE + $this->tinyMcePages(); + //require_once "core/vendor/sitemap/SitemapGenerator.php"; $timezone = $this->getData(['config', 'timezone']); @@ -1035,6 +1056,8 @@ class common } return (file_exists('sitemap.xml') && file_exists('robots.txt')); + + } /* @@ -1109,8 +1132,9 @@ class common include 'core/layout/mail.php'; $layout = ob_get_clean(); $mail = new PHPMailer\PHPMailer\PHPMailer; - $mail->CharSet = 'UTF-8'; $mail->setLanguage(substr(self::$i18nUI, 0, 2), 'core/class/phpmailer/i18n/'); + $mail->CharSet = 'UTF-8'; + $mail->Encoding = 'base64'; // Mail try { // Paramètres SMTP perso @@ -1119,27 +1143,25 @@ class common $mail->isSMTP(); $mail->SMTPAutoTLS = false; $mail->SMTPSecure = false; - $mail->SMTPAuth = false; + $mail->SMTPAuth = false; $mail->Host = $this->getdata(['config', 'smtp', 'host']); $mail->Port = (int) $this->getdata(['config', 'smtp', 'port']); if ($this->getData(['config', 'smtp', 'auth'])) { - $mail->SMTPAutoTLS = true; $mail->SMTPSecure = true; $mail->SMTPAuth = $this->getData(['config', 'smtp', 'auth']); $mail->Username = $this->getData(['config', 'smtp', 'username']); - $mail->Password = helper::decrypt($this->getData(['config', 'smtp', 'username']), $this->getData(['config', 'smtp', 'password'])); - $mail->SMTPSecure = $this->getData(['config', 'smtp', 'secure']); + $mail->Password = helper::decrypt($this->getData(['config', 'smtp', 'password']),$this->getData(['config', 'smtp', 'host'])); } } // Expéditeur $host = str_replace('www.', '', $_SERVER['HTTP_HOST']); $from = $from ? $from : 'no-reply@' . $host; - $mail->setFrom($from, $this->getData(['locale', 'title'])); + $mail->setFrom($from, html_entity_decode($this->getData(['locale', 'title']))); // répondre à if (is_null($replyTo)) { - $mail->addReplyTo($from, $this->getData(['locale', 'title'])); + $mail->addReplyTo($from, html_entity_decode($this->getData(['locale', 'title']))); } else { $mail->addReplyTo($replyTo); } @@ -1153,7 +1175,7 @@ class common $mail->addAddress($to); } $mail->isHTML(true); - $mail->Subject = $subject; + $mail->Subject = html_entity_decode($subject); $mail->Body = $layout; $mail->AltBody = strip_tags($content); if ($mail->send()) { @@ -1162,7 +1184,7 @@ class common return $mail->ErrorInfo; } } catch (Exception $e) { - return $e->getMessage(); + return $mail->ErrorInfo; } } @@ -1258,7 +1280,7 @@ class common new RecursiveCallbackFilterIterator( new RecursiveDirectoryIterator( $folder, - RecursiveDirectoryIterator::SKIP_DOTS + RecursiveDirectoryIterator::SKIP_DOTS ), function ($fileInfo, $key, $iterator) use ($filter) { return $fileInfo->isFile() || !in_array($fileInfo->getBaseName(), $filter); diff --git a/core/layout/common.css b/core/layout/common.css index 05420559..54f447cd 100755 --- a/core/layout/common.css +++ b/core/layout/common.css @@ -951,6 +951,38 @@ footer #footerSocials .zwiico-github:hover { background: #000; } +footer #footerSocials .zwiico-reddit { + background: #FF4500; +} + +footer #footerSocials .zwiico-reddit:hover { + background: #D23311; +} + +footer #footerSocials .zwiico-steam { + background: #171A21; +} + +footer #footerSocials .zwiico-steam:hover { + background: #0F1318; +} + +footer #footerSocials .zwiico-vimeo { + background: #162221; +} + +footer #footerSocials .zwiico-vimeo:hover { + background: #121B1E; +} + +footer #footerSocials .zwiico-twitch { + background: #9146FF; +} + +footer #footerSocials .zwiico-twitch:hover { + background: #703CEC; +} + /* Bulle de dialogue */ diff --git a/core/layout/mail.php b/core/layout/mail.php index b4b31b43..4b6bc10c 100644 --- a/core/layout/mail.php +++ b/core/layout/mail.php @@ -1,7 +1,7 @@ - + diff --git a/core/module/config/config.php b/core/module/config/config.php index 882b3ba0..b5b5348c 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -213,7 +213,7 @@ class config extends common { // Mettre à jour le site map - $successSitemap = $this->createSitemap(); + $successSitemap = $this->updateSitemap(); // Valeurs en sortie $this->addOutput([ @@ -451,16 +451,20 @@ class config extends common 'twitterId' => $this->getInput('socialTwitterId'), 'youtubeId' => $this->getInput('socialYoutubeId'), 'youtubeUserId' => $this->getInput('socialYoutubeUserId'), - 'githubId' => $this->getInput('socialGithubId') + 'githubId' => $this->getInput('socialGithubId'), + 'redditId' => $this->getInput('socialRedditId'), + 'twitchId' => $this->getInput('socialTwitchId'), + 'vimeoId' => $this->getInput('socialVimeoId'), + 'steamId' =>$this->getInput('socialSteamId'), ], 'smtp' => [ 'enable' => $this->getInput('smtpEnable', helper::FILTER_BOOLEAN), - 'host' => $this->getInput('smtpHost', helper::FILTER_STRING_SHORT, $this->getInput('smtpEnable', helper::FILTER_BOOLEAN)), - 'port' => $this->getInput('smtpPort', helper::FILTER_INT, $this->getInput('smtpEnable', helper::FILTER_BOOLEAN)), + 'host' => $this->getInput('smtpHost', helper::FILTER_STRING_SHORT), + 'port' => $this->getInput('smtpPort', helper::FILTER_INT), 'auth' => $this->getInput('smtpAuth', helper::FILTER_BOOLEAN), 'secure' => $this->getInput('smtpSecure', helper::FILTER_STRING_SHORT), - 'username' => $this->getInput('smtpUsername', helper::FILTER_STRING_SHORT, $this->getInput('smtpAuth', helper::FILTER_BOOLEAN)), - 'password' => helper::encrypt($this->getData(['config', 'smtp', 'username']), $this->getInput('smtpPassword', null, $this->getInput('smtpAuth', helper::FILTER_BOOLEAN))), + 'username' => $this->getInput('smtpUsername', helper::FILTER_STRING_SHORT), + 'password' => helper::encrypt($this->getInput('smtpPassword', helper::FILTER_STRING_SHORT),$this->getInput('smtpHost', helper::FILTER_STRING_SHORT)), 'from' => $this->getInput('smtpFrom', helper::FILTER_MAIL, true), ], 'seo' => [ diff --git a/core/module/config/view/social/social.php b/core/module/config/view/social/social.php index 3f3f27c9..e67063fd 100644 --- a/core/module/config/view/social/social.php +++ b/core/module/config/view/social/social.php @@ -2,7 +2,8 @@
    -

    +

    + - - signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?> - - getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' - ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?> +
    +
    + + + signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?> + + getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' - ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?> +
    -

    -
    -
    - getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']) && - file_exists(self::FILE_DIR . 'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture'])) - ) : ?> - getData(['module', $this->getUrl(0), 'posts', $articleId, 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'pictureSize']); ?> - getData(['module', $this->getUrl(0), 'posts', $articleId, 'hidePicture']) == false) { - echo '' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']) . ''; - } ?> - - getData(['module', $this->getUrl(0), 'posts', $articleId, 'content']); ?> +
    +
    + getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']) && + file_exists(self::FILE_DIR . 'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture'])) + ): ?> + getData(['module', $this->getUrl(0), 'posts', $articleId, 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'pictureSize']); ?> + getData(['module', $this->getUrl(0), 'posts', $articleId, 'hidePicture']) == false) { + echo '' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']) . ''; + } ?> + + getData(['module', $this->getUrl(0), 'posts', $articleId, 'content']); ?> +
    -
    -
    -
    - - +
    + + getUser('password') === $this->getInput('ZWII_USER_PASSWORD') - and - ( // Propriétaire - ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === $module::EDIT_OWNER - and ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']) === $this->getUser('id') - or $this->getUser('group') === self::GROUP_ADMIN) + $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') + and + ( // Propriétaire + ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === $module::EDIT_OWNER + and ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']) === $this->getUser('id') + or $this->getUser('group') === self::GROUP_ADMIN) + ) + or ( + // Groupe + ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === self::GROUP_ADMIN + or $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === self::GROUP_MODERATOR) + and $this->getUser('group') >= $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) + ) + or ( + // Tout le monde + $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === $module::EDIT_ALL + and $this->getUser('group') >= $module::$actions['config'] + ) ) - or ( - // Groupe - ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === self::GROUP_ADMIN - or $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === self::GROUP_MODERATOR) - and $this->getUser('group') >= $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) - ) - or ( - // Tout le monde - $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === $module::EDIT_ALL - and $this->getUser('group') >= $module::$actions['config'] - ) - ) - ) : ?> - - Éditer - - -
    -
    - getData(['module', $this->getUrl(0), 'posts', $articleId, 'commentClose'])) : ?> -

    Cet article ne reçoit pas de commentaire.

    - -

    - 'right']); ?> - 0) { - echo ''; - echo $module::$comments[$articleId] . ' commentaire' . ($module::$comments[$articleId] > 1 ? 's' : ''); - echo ''; - } else { - echo 'Pas encore de commentaire'; - } - ?> -

    - + ): ?> + + Éditer + + +
    +
    + getData(['module', $this->getUrl(0), 'posts', $articleId, 'commentClose'])): ?> +

    Cet article ne reçoit pas de commentaire.

    + +

    + 'right']); ?> + 0) { + echo ''; + echo $module::$comments[$articleId] . ' commentaire' . ($module::$comments[$articleId] > 1 ? 's' : ''); + echo ''; + } else { + echo 'Pas encore de commentaire'; + } + ?> +

    + +
    - -
    + +
    + ): ?>
    getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture'])); - $thumb = 'mini_' . $parts['basename']; - // Créer la miniature si manquante - if (!file_exists(self::FILE_DIR . 'thumb/' . $thumb)) { - $this->makeThumb( - self::FILE_DIR . 'source/' . $article['picture'], - self::FILE_DIR . 'thumb/' . $thumb, - self::THUMBS_WIDTH - ); - } - ?> + $parts = pathinfo($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture'])); + $thumb = 'mini_' . $parts['basename']; + // Créer la miniature si manquante + if (!file_exists(self::FILE_DIR . 'thumb/' . $thumb)) { + $this->makeThumb( + self::FILE_DIR . 'source/' . $article['picture'], + self::FILE_DIR . 'thumb/' . $thumb, + self::THUMBS_WIDTH + ); + } + ?> - <?php echo $article['picture']; ?> + <?php echo $article['picture']; ?>
    - +

    @@ -129,30 +133,40 @@

    - + 'left']); ?>
    - - - signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']));?> - - getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' - ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?> + + + signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?> + + getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' - ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?>
    -

    - getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) !== 0 ? $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) : 500 ?> +

    + getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) !== 0 ? $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) : 500 ?>

    '), 0, $lenght); ?>... - Lire la suite -

    +
    - - +
    + + - + \ No newline at end of file diff --git a/module/blog/view/option/option.php b/module/blog/view/option/option.php index 5aa1c6d4..a761e381 100755 --- a/module/blog/view/option/option.php +++ b/module/blog/view/option/option.php @@ -1,64 +1,71 @@ -
    -
    - 'buttonGrey', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'value' => template::ico('left') - ]); ?> -
    -
    - -
    +
    +
    + 'buttonGrey', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', + 'value' => template::ico('left') + ]); ?>
    -
    -
    -
    -

    -
    -
    - 'Disposition', - 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) - ]); ?> -
    -
    - 'Articles par page', - 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) - ]); ?> -
    -
    - 'Format des dates', - 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']) - ]); ?> -
    -
    - 'Format des heures', - 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']) - ]); ?> -
    +
    + +
    +
    +
    +
    +
    +

    + +

    +
    +
    + 'Disposition', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'layout']) + ]); ?>
    -
    -
    - $this->getData(['module', $this->getUrl(0), 'config', 'feeds']), - ]); ?> -
    -
    - 'Texte de l\'étiquette', - 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel']) - ]); ?> -
    +
    + 'Aperçus', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) + ]); ?> +
    +
    + 'Articles par page', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) + ]); ?> +
    +
    + 'Format des dates', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']) + ]); ?> +
    +
    + 'Format des heures', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']) + ]); ?> +
    +
    +
    +
    + $this->getData(['module', $this->getUrl(0), 'config', 'feeds']), + ]); ?> +
    +
    + 'Texte de l\'étiquette', + 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel']) + ]); ?>
    +
    Version n° -
    - +
    \ No newline at end of file diff --git a/module/form/changes.md b/module/form/changes.md index 1ca82afc..84e094cc 100644 --- a/module/form/changes.md +++ b/module/form/changes.md @@ -1,17 +1,19 @@ +# Version 3.8 +- Encode UTF-8 de l'objet du message, et des noms des champs. # Version 3.7 -- Modification liées à la suppression de flatpickr +- Modification liées à la suppression de flatpickr. # Version 3.6 -- Appel de fonction incorrect +- Appel de fonction incorrect. # Version 3.5 - Multilingue # Version 3.4 - Bug de présentation, une div en trop. # Version 3.3 -- Multilinguisme +- Multilinguisme. # Version 3.2 -- Bug variable non initialisée +- Bug variable non initialisée. # Version 3.1 -- Initialisation des paramètres personnalisés +- Initialisation des paramètres personnalisés. # Version 3 -- Déplacement des options de formulaires -- Gabarit du formulaire sur la page +- Déplacement des options de formulaires. +- Gabarit du formulaire sur la page. diff --git a/module/form/form.php b/module/form/form.php index 0a061c8a..615692ac 100644 --- a/module/form/form.php +++ b/module/form/form.php @@ -14,23 +14,24 @@ * @link http://zwiicms.fr/ */ -class form extends common { +class form extends common +{ - const VERSION = '3.7'; + const VERSION = '3.8'; const REALNAME = 'Formulaire'; const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json) public static $actions = [ 'config' => self::GROUP_MODERATOR, - 'option' => self::GROUP_MODERATOR, + 'option' => self::GROUP_MODERATOR, 'data' => self::GROUP_MODERATOR, 'delete' => self::GROUP_MODERATOR, 'deleteall' => self::GROUP_MODERATOR, 'index' => self::GROUP_VISITOR, 'export2csv' => self::GROUP_MODERATOR, 'output2csv' => self::GROUP_MODERATOR, - 'init' => self::GROUP_MODERATOR, - 'update' => self::GROUP_MODERATOR, + 'init' => self::GROUP_MODERATOR, + 'update' => self::GROUP_MODERATOR, ]; public static $data = []; @@ -80,32 +81,33 @@ class form extends common { ]; public static $optionOffset = [ - 0 => 'Aucune', - 1 => 'Une colonne', - 2 => 'Deux colonnes' + 0 => 'Aucune', + 1 => 'Une colonne', + 2 => 'Deux colonnes' ]; public static $optionWidth = [ - 6 => 'Six colonnes', - 7 => 'Sept colonnes', - 8 => 'Huit colonnes', - 9 => 'Neuf colonnes', - 10 => 'Dix colonnes', - 11 => 'Onze colonnes', - 12 => 'Douze colonnes', + 6 => 'Six colonnes', + 7 => 'Sept colonnes', + 8 => 'Huit colonnes', + 9 => 'Neuf colonnes', + 10 => 'Dix colonnes', + 11 => 'Onze colonnes', + 12 => 'Douze colonnes', ]; public static $optionAlign = [ - '' => 'A gauche', - 'textAlignCenter' => 'Au centre', - 'textAlignRight' => 'A droite' + '' => 'A gauche', + 'textAlignCenter' => 'Au centre', + 'textAlignRight' => 'A droite' ]; /** * Configuration */ - public function config() { + public function config() + { // Mise à jour des données de module $this->update(); @@ -113,21 +115,21 @@ class form extends common { // Liste des utilisateurs $userIdsFirstnames = helper::arrayColumn($this->getData(['user']), 'firstname'); ksort($userIdsFirstnames); - self::$listUsers [] = ''; - foreach($userIdsFirstnames as $userId => $userFirstname) { - self::$listUsers [] = $userId; + self::$listUsers[] = ''; + foreach ($userIdsFirstnames as $userId => $userFirstname) { + self::$listUsers[] = $userId; } // Soumission du formulaire - if($this->isPost()) { + if ($this->isPost()) { // Génération des données vides if ($this->getData(['module', $this->getUrl(0), 'data']) === null) { $this->setData(['module', $this->getUrl(0), 'data', []]); } // Génération des champs $inputs = []; - foreach($this->getInput('formConfigPosition', null) as $index => $position) { + foreach ($this->getInput('formConfigPosition', null) as $index => $position) { $inputs[] = [ - 'name' => htmlspecialchars_decode($this->getInput('formConfigName[' . $index . ']'),ENT_QUOTES), + 'name' => html_entity_decode($this->getInput('formConfigName[' . $index . ']')), 'position' => helper::filter($position, helper::FILTER_INT), 'required' => $this->getInput('formConfigRequired[' . $index . ']', helper::FILTER_BOOLEAN), 'type' => $this->getInput('formConfigType[' . $index . ']'), @@ -142,13 +144,6 @@ class form extends common { 'state' => true ]); } - // Liste des pages - foreach($this->getHierarchy(null, false) as $parentPageId => $childrenPageIds) { - self::$pages[$parentPageId] = $this->getData(['page', $parentPageId, 'title']); - foreach($childrenPageIds as $childKey) { - self::$pages[$childKey] = '    ' . $this->getData(['page', $childKey, 'title']); - } - } // Valeurs en sortie $this->addOutput([ 'title' => helper::translate('Configuration du module'), @@ -161,20 +156,21 @@ class form extends common { } - public function option() { + public function option() + { // Liste des utilisateurs $userIdsFirstnames = helper::arrayColumn($this->getData(['user']), 'firstname'); ksort($userIdsFirstnames); - self::$listUsers [] = ''; + self::$listUsers[] = ''; foreach ($userIdsFirstnames as $userId => $userFirstname) { - self::$listUsers [] = $userId; + self::$listUsers[] = $userId; } // Soumission du formulaire if ($this->isPost()) { // Débordement $width = $this->getInput('formOptionWidth'); - if ($this->getInput('formOptionWidth',helper::FILTER_INT) + $this->getInput('formOptionOffset',helper::FILTER_INT) > 12 ) { - $width = (string) $this->getInput('formOptionWidth',helper::FILTER_INT) - $this->getInput('formOptionOffset',helper::FILTER_INT); + if ($this->getInput('formOptionWidth', helper::FILTER_INT) + $this->getInput('formOptionOffset', helper::FILTER_INT) > 12) { + $width = (string) $this->getInput('formOptionWidth', helper::FILTER_INT) - $this->getInput('formOptionOffset', helper::FILTER_INT); } // Configuration @@ -186,17 +182,17 @@ class form extends common { 'button' => $this->getInput('formOptionButton'), 'captcha' => $this->getInput('formOptionCaptcha', helper::FILTER_BOOLEAN), 'group' => $this->getInput('formOptionGroup', helper::FILTER_INT), - 'user' => self::$listUsers [$this->getInput('formOptionUser', helper::FILTER_INT)], - 'mail' => $this->getInput('formOptionMail') , + 'user' => self::$listUsers[$this->getInput('formOptionUser', helper::FILTER_INT)], + 'mail' => $this->getInput('formOptionMail'), 'pageId' => $this->getInput('formOptionPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formOptionPageId', helper::FILTER_ID) : '', - 'subject' => $this->getInput('formOptionSubject'), + 'subject' => html_entity_decode($this->getInput('formOptionSubject')), 'replyto' => $this->getInput('formOptionMailReplyTo', helper::FILTER_BOOLEAN), 'signature' => $this->getInput('formOptionSignature'), 'logoUrl' => $this->getInput('formOptionLogo'), 'logoWidth' => $this->getInput('formOptionLogoWidth'), - 'offset' =>$this->getInput('formOptionOffset'), - 'width' =>$width, - 'align' =>$this->getInput('formOptionAlign'), + 'offset' => $this->getInput('formOptionOffset'), + 'width' => $width, + 'align' => $this->getInput('formOptionAlign'), ] ]); // Génération des données vides @@ -209,12 +205,12 @@ class form extends common { 'redirect' => helper::baseUrl() . $this->getUrl(), 'state' => true ]); - } else { + } else { // Liste des pages - foreach($this->getHierarchy(null, false) as $parentPageId => $childrenPageIds) { + foreach ($this->getHierarchy(null, true, false) as $parentPageId => $childrenPageIds) { self::$pages[$parentPageId] = $this->getData(['page', $parentPageId, 'title']); - foreach($childrenPageIds as $childKey) { - self::$pages[$childKey] = '    ' . $this->getData(['page', $childKey, 'title']); + foreach ($childrenPageIds as $childKey) { + self::$pages[$childKey] = ' » ' . $this->getData(['page', $childKey, 'title']); } } // Valeurs en sortie @@ -232,9 +228,10 @@ class form extends common { /** * Données enregistrées */ - public function data() { + public function data() + { $data = $this->getData(['module', $this->getUrl(0), 'data']); - if($data) { + if ($data) { // Pagination $pagination = helper::pagination($data, $this->getUrl(), self::$itemsperPage); // Liste des pages @@ -243,16 +240,16 @@ class form extends common { $dataIds = array_reverse(array_keys($data)); $data = array_reverse($data); // Données en fonction de la pagination - for($i = $pagination['first']; $i < $pagination['last']; $i++) { + for ($i = $pagination['first']; $i < $pagination['last']; $i++) { $content = ''; - foreach($data[$i] as $input => $value) { + foreach ($data[$i] as $input => $value) { $content .= $input . ' : ' . $value . '
    '; } self::$data[] = [ $content, template::button('formDataDelete' . $dataIds[$i], [ 'class' => 'formDataDelete buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $dataIds[$i] . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $dataIds[$i] . '/' . $_SESSION['csrf'], 'value' => template::ico('trash') ]) ]; @@ -268,39 +265,40 @@ class form extends common { /** * Export CSV * @author Frédéric Tempez - * @copyright Copyright (C) 2018-2023, Frédéric Tempez + * @copyright Copyright (C) 2018-2023, Frédéric Tempez */ - public function export2csv() { + public function export2csv() + { // Jeton incorrect if ($this->getUrl(2) !== $_SESSION['csrf']) { // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', 'notification' => helper::translate('Action interdite') ]); } else { $data = $this->getData(['module', $this->getUrl(0), 'data']); if ($data !== []) { - $csvfilename = 'data-'.date('dmY').'-'.date('hm').'-'.rand(10,99).'.csv'; - if (!file_exists(self::FILE_DIR.'source/data')) { - mkdir(self::FILE_DIR.'source/data', 0755); + $csvfilename = 'data-' . date('dmY') . '-' . date('hm') . '-' . rand(10, 99) . '.csv'; + if (!file_exists(self::FILE_DIR . 'source/data')) { + mkdir(self::FILE_DIR . 'source/data', 0755); } - $fp = fopen(self::FILE_DIR.'source/data/'.$csvfilename, 'w'); - fputcsv($fp, array_keys($data[1]), ';','"'); + $fp = fopen(self::FILE_DIR . 'source/data/' . $csvfilename, 'w'); + fputcsv($fp, array_keys($data[1]), ';', '"'); foreach ($data as $fields) { - fputcsv($fp, $fields, ';','"'); + fputcsv($fp, $fields, ';', '"'); } fclose($fp); // Valeurs en sortie $this->addOutput([ 'notification' => sprintf(helper::translate('Export CSV effectué dans %1 '), $csvfilename), - 'redirect' => helper::baseUrl() . $this->getUrl(0) .'/data', + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', 'state' => true ]); } else { $this->addOutput([ 'notification' => helper::translate('Aucune donnée à exporter'), - 'redirect' => helper::baseUrl() . $this->getUrl(0) .'/data' + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data' ]); } } @@ -310,19 +308,20 @@ class form extends common { /** * Suppression */ - public function deleteall() { + public function deleteall() + { // Jeton incorrect if ($this->getUrl(2) !== $_SESSION['csrf']) { // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', 'notification' => helper::translate('Action interdite') ]); } else { $data = ($this->getData(['module', $this->getUrl(0), 'data'])); - if (count($data) > 0 ) { + if (count($data) > 0) { // Suppression multiple - for ($i = 1; $i <= count($data) ; $i++) { + for ($i = 1; $i <= count($data); $i++) { echo $this->deleteData(['module', $this->getUrl(0), 'data', $i]); } // Valeurs en sortie @@ -345,17 +344,18 @@ class form extends common { /** * Suppression */ - public function delete() { + public function delete() + { // Jeton incorrect if ($this->getUrl(3) !== $_SESSION['csrf']) { // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', 'notification' => helper::translate('Action interdite') ]); } else { // La donnée n'existe pas - if($this->getData(['module', $this->getUrl(0), 'data', $this->getUrl(2)]) === null) { + if ($this->getData(['module', $this->getUrl(0), 'data', $this->getUrl(2)]) === null) { // Valeurs en sortie $this->addOutput([ 'access' => false @@ -380,19 +380,20 @@ class form extends common { /** * Accueil */ - public function index() { + public function index() + { // Mise à jour des données de module $this->update(); // Soumission du formulaire - if($this->isPost()) { + if ($this->isPost()) { // Check la captcha - if( + if ( $this->getData(['module', $this->getUrl(0), 'config', 'captcha']) // AND $this->getInput('formcaptcha', helper::FILTER_INT) !== $this->getInput('formcaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('formcaptchaSecondNumber', helper::FILTER_INT)) - AND password_verify($this->getInput('formCaptcha', helper::FILTER_INT), $this->getInput('formCaptchaResult') ) === false ) - { + and password_verify($this->getInput('formCaptcha', helper::FILTER_INT), $this->getInput('formCaptchaResult')) === false + ) { self::$inputNotices['formCaptcha'] = helper::translate('Captcha incorrect'); } @@ -400,9 +401,9 @@ class form extends common { $data = []; $replyTo = null; $content = ''; - foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) { + foreach ($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) { // Filtre la valeur - switch($input['type']) { + switch ($input['type']) { case self::TYPE_MAIL: $filter = helper::FILTER_MAIL; break; @@ -420,10 +421,12 @@ class form extends common { } $value = $this->getInput('formInput[' . $index . ']', $filter, $input['required']) === true ? 'X' : $this->getInput('formInput[' . $index . ']', $filter, $input['required']); // premier champ email ajouté au mail en reply si option active - if ($this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true && - $input['type'] === 'mail') { + if ( + $this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true && + $input['type'] === 'mail' + ) { $replyTo = $value; - } + } // Préparation des données pour la création dans la base $data[$this->getData(['module', $this->getUrl(0), 'input', $index, 'name'])] = $value; // Préparation des données pour le mail @@ -434,23 +437,25 @@ class form extends common { // Envoi du mail // Rechercher l'adresse en fonction du mail $sent = true; - $singleuser = $this->getData(['user', - $this->getData(['module', $this->getUrl(0), 'config', 'user']), - 'mail']); + $singleuser = $this->getData([ + 'user', + $this->getData(['module', $this->getUrl(0), 'config', 'user']), + 'mail' + ]); $singlemail = $this->getData(['module', $this->getUrl(0), 'config', 'mail']); $group = $this->getData(['module', $this->getUrl(0), 'config', 'group']); // Verification si le mail peut être envoyé - if( + if ( self::$inputNotices === [] && ( $group > 0 || $singleuser !== '' || - $singlemail !== '' ) + $singlemail !== '') ) { // Utilisateurs dans le groupe $to = []; - if ($group > 0){ - foreach($this->getData(['user']) as $userId => $user) { - if($user['group'] >= $group) { + if ($group > 0) { + foreach ($this->getData(['user']) as $userId => $user) { + if ($user['group'] >= $group) { $to[] = $user['mail']; } } @@ -463,10 +468,10 @@ class form extends common { if (!empty($singlemail)) { $to[] = $singlemail; } - if($to) { + if ($to) { // Sujet du mail $subject = $this->getData(['module', $this->getUrl(0), 'config', 'subject']); - if($subject === '') { + if ($subject === '') { $subject = 'Nouveau message en provenance de votre site'; } // Envoi le mail @@ -486,7 +491,7 @@ class form extends common { $this->addOutput([ 'notification' => ($sent === true ? helper::translate('Formulaire soumis') : $sent), 'redirect' => $redirect ? helper::baseUrl() . $redirect : '', - 'state' => ($sent === true ? true : null), + 'state' => ($sent === true ? true : false), 'vendor' => [ 'flatpickr' ], @@ -507,23 +512,25 @@ class form extends common { * Mise à jour du module * Appelée par les fonctions index et config */ - private function update() { + private function update() + { // le module n'est pas initialisé - if ( $this->getData(['module',$this->getUrl(0), 'config']) === NULL ) { + if ($this->getData(['module', $this->getUrl(0), 'config']) === NULL) { $this->init(); } } - /** + /** * Initialisation du thème d'un nouveau module */ - private function init() { + private function init() + { // Données du module absentes require_once('module/form/ressource/defaultdata.php'); - if ($this->getData(['module', $this->getUrl(0), 'config' ]) === null) { + if ($this->getData(['module', $this->getUrl(0), 'config']) === null) { $this->setData(['module', $this->getUrl(0), 'config', init::$defaultData]); } } -} +} \ No newline at end of file diff --git a/module/news/view/index/index.php b/module/news/view/index/index.php index 10ebf140..14da4d51 100644 --- a/module/news/view/index/index.php +++ b/module/news/view/index/index.php @@ -46,6 +46,7 @@ && strlen($this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'content'])) >= $this->getData(['module', $this->getUrl(0), 'config', 'height']) ): ?> getUrl(0) . '/' . $newsId . '">lire la suite'; ?> +