diff --git a/.htaccess b/.htaccess index d860b72..bbab795 100644 --- a/.htaccess +++ b/.htaccess @@ -3,26 +3,12 @@ Require all denied - - mod_gzip_on Yes - mod_gzip_dechunk Yes - mod_gzip_item_include file \.(html?|txt|css|js|php|woff)$ - mod_gzip_item_include handler ^cgi-script$ - mod_gzip_item_include mime ^text\.* - mod_gzip_item_include mime ^application/x-javascript.* - mod_gzip_item_exclude mime ^image\.* - mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* - - AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/shtml AddOutputFilterByType DEFLATE text/css - AddOutputFilterByType DEFLATE font/woff - AddOutputFilterByType DEFLATE font/woff2 - AddOutputFilterByType DEFLATE application/font-woff AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml diff --git a/CHANGES.md b/CHANGES.md index 80913a1..85773ce 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,9 +1,22 @@ # Changelog +## Version 4.3.08 de Deltacms +- Modifications : + - Captcha : nouvelle option 'Captcha simple pour les humains', le Captcha se réduit à une simple case à cocher, une analyse comportementale + qualifie le type de visiteur, + - Captcha : nouveau captcha, suppression des options captcha renforcé et type de captcha, + - Tinymce / image : nouvelle option permettant d'afficher un titre sous l'image, + - News 4.3 prise en compte de l'option titre sous l'image, +- Corrections : + - Configuration / configuration : 2 'textarea' avaient le même identifiant. + - News 4.3 déplacement de l'initialisation de tinymce et flatpickr, + - Blog 6.4 déplacement de l'initialisation de tinymce et flatpickr, + - Divers : mise en conformité W3C. + ## Version 4.3.07 de Deltacms - Modifications : - Configuration / Thème / Header : nouvelle option bannière visible uniquement sur la page d'accueil, -- Correction : +- Corrections : - Snipcart : modification dans Core / Page / Edition pour compatibilité avec ce module, - Agenda 5.4 : correction d'un bug critique lié à la limitation des droits liés aux évènements, mise à jour indispensable, - Configuration / Thème / Header : correction de plusieurs bugs notamment pour l'affichage en mode aperçu. diff --git a/README.md b/README.md index 00b162f..bea3e4f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# DeltaCMS 4.3.07 +# DeltaCMS 4.3.08 DeltaCMS 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. L'administration du site est bilingue anglais ou français, le site peut être rédigé dans une des principales langues européennes. diff --git a/core/class/template.class.php b/core/class/template.class.php index d6292a1..edf63be 100644 --- a/core/class/template.class.php +++ b/core/class/template.class.php @@ -35,120 +35,17 @@ class template { /** * Crée un champ captcha * @param string $nameId Nom et id du champ - * @param array $attributes Attributs ($key => $value) * @return string */ - public static function captcha($nameId, array $attributes = []) { - // Attributs par défaut - $attributes = array_merge([ - 'class' => '', - 'classWrapper' => '', - 'help' => '', - 'id' => $nameId, - 'name' => $nameId, - 'value' => '', - 'limit' => false, // captcha simple - 'type'=> 'alpha' // num(érique) ou alpha(bétique) - ], $attributes); - - // Captcha quatre opérations - // Limite addition et soustraction selon le type de captcha - $numbers = [0,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20]; - $letters = ['u','t','s','r','q','p','o','n','m','l','k','j','i','h','g','f','e','d','c','b','a']; - $limit = $attributes['limit'] ? count($letters)-1 : 10; - - // Tirage de l'opération - mt_srand((int)(microtime(true)*1000000)); - // Captcha simple limité à l'addition - $operator = $attributes['limit'] ? mt_rand (1, 4) : 1; - - // Limite si multiplication ou division - if ($operator > 2) { - $limit = 10; - } - - // Tirage des nombres - mt_srand((int)(microtime(true)*1000000)); - $firstNumber = mt_rand (1, $limit); - mt_srand((int)(microtime(true)*1000000)); - $secondNumber = mt_rand (1, $limit); - - // Permutation si addition ou soustraction - if (($operator < 3) and ($firstNumber < $secondNumber)) { - $temp = $firstNumber; - $firstNumber = $secondNumber; - $secondNumber = $temp; - } - - // Icône de l'opérateur et calcul du résultat - switch ($operator) { - case 1: - $operator = template::ico('plus'); - $result = $firstNumber + $secondNumber; - break; - case 2: - $operator = template::ico('minus'); - $result = $firstNumber - $secondNumber; - break; - case 3: - $operator = template::ico('cancel'); - $result = $firstNumber * $secondNumber; - break; - case 4: - $operator = template::ico('divide'); - $limit2 = [10, 10, 6, 5, 4, 3, 2, 2, 2, 2]; - for ($i = 1; $i <= $firstNumber; $i++) { - $limit = $limit2[$i-1]; - } - mt_srand((int)(microtime(true)*1000000)); - $secondNumber = mt_rand(1, $limit); - $firstNumber = $firstNumber * $secondNumber; - $result = $firstNumber / $secondNumber; - break; - } - - // Hashage du résultat - $result = password_hash($result, PASSWORD_BCRYPT); - - // Codage des valeurs de l'opération - $firstLetter = uniqid(); - $secondLetter = uniqid(); - - // Masquage image source pour éviter un décodage - copy ('core/vendor/zwiico/png/' . $attributes['type'] . '/' . $letters[$firstNumber] . '.png', 'site/tmp/' . $firstLetter . '.png'); - copy ('core/vendor/zwiico/png/' . $attributes['type'] . '/' . $letters[$secondNumber] . '.png', 'site/tmp/' . $secondLetter . '.png'); - - // Début du wrapper - $html = '
'; - // Label - $html .= self::label($attributes['id'], - ' ' . $operator . '  = ', [ - 'help' => $attributes['help'] - ]); - - // Notice - $notice = ''; - if(array_key_exists($attributes['id'], common::$inputNotices)) { - $notice = common::$inputNotices[$attributes['id']]; - $attributes['class'] .= ' notice'; - } - $html .= self::notice($attributes['id'], $notice); - - // captcha - $html .= sprintf( - '', - helper::sprintAttributes($attributes) - ); - - // Champ résultat codé - $html .= self::hidden($attributes['id'] . 'Result', [ - 'value' => $result, - 'before' => false - ]); - - // Fin du wrapper - $html .= '
'; - + public static function captcha($nameId, $classWrapper) { + + $html = '
'; + $html .= 'Captcha'; + $html .= ''; + $html .= ''; + $html .= '
'; + // Retourne le html return $html; } @@ -171,8 +68,10 @@ class template { 'disabled' => false, 'help' => '', 'id' => $nameId, - 'name' => $nameId + 'name' => $nameId, + 'required' => false ], $attributes); + // Sauvegarde des données en cas d'erreur if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) { $attributes['checked'] = (bool) common::$inputBefore[$attributes['id']]; @@ -187,11 +86,20 @@ class template { } $html .= self::notice($attributes['id'], $notice); // Case à cocher - $html .= sprintf( - '', - $value, - helper::sprintAttributes($attributes) - ); + if( $attributes['required'] === false ){ + $html .= sprintf( + '', + $value, + helper::sprintAttributes($attributes) + ); + } else { + $html .= sprintf( + '', + $value, + helper::sprintAttributes($attributes) + ); + + } // Label $html .= self::label($attributes['id'], '' . $label . '', [ 'help' => $attributes['help'] diff --git a/core/core.php b/core/core.php index f8e4bae..665a193 100644 --- a/core/core.php +++ b/core/core.php @@ -48,7 +48,7 @@ class common { // Numéro de version const DELTA_UPDATE_URL = 'https://update.deltacms.fr/master/'; - const DELTA_VERSION = '4.3.07'; + const DELTA_VERSION = '4.3.08'; const DELTA_UPDATE_CHANNEL = "v4"; public static $actions = []; @@ -267,6 +267,15 @@ class common { if($this->user === []) { $this->user = $this->getData(['user', $this->getInput('DELTA_USER_ID')]); } + + /** + * Discrimination humain robot pour shuntage des Captchas + * Initialisation à 'bot' ou 'human' en fonction des données $_SERVER : à développer ! + */ + if( !isset( $_SESSION['humanBot'] )){ + $_SESSION['humanBot'] = 'bot'; + if( !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) $_SESSION['humanBot'] = 'human'; + } /** * Traduction du site par script @@ -1189,7 +1198,7 @@ class common { $item .= '

'. $this->getData(['locale', 'cookies', 'cookiesTitleText']) . '

'; $item .= '

' . $this->getData(['locale', 'cookies', 'cookiesDeltaText']) . '

'; // Formulaire de réponse - $item .= '
'; + $item .= ''; $cookieExt = $this->getData(['locale', 'cookies', 'cookiesExtText']); $stateCookieExt = $this->getInput('DELTA_COOKIE_EXT_CONSENT') === 'true' ? 'checked="checked"' : ''; if( $cookieExt !== null AND $cookieExt !== '' ) { @@ -2162,11 +2171,11 @@ class common { ) ) { $select = ' class="i18nFlagSelected" '; } else { - $select = ' class="i18nFlag" '; + $select = ' class="i18nFlag flag" '; } echo '
  • '; - echo '' .  $value . ''; + echo '' .  $value . ''; echo '
  • '; } } @@ -2354,7 +2363,10 @@ class core extends common { $css .= '.block h4 {background-color:'. $colors['normal'] . ';color:' . $colors['text'] .';border-radius: ' . $this->getdata(['theme','block','blockBorderRadius']) . ' ' . $this->getdata(['theme','block','blockBorderRadius']) . ' 0px 0px;}'; $css .= '.block p {margin: 0px -5px;}'; //$css .= '.mce-tinymce {border: 1px solid ' . $this->getdata(['theme','block','borderColor']) .' !important;}'; - + + //Tinymce option titre sous une image valeurs par défaut modifiables dans custom.css + $css .= 'figure.image { border-color: ' . $this->getdata(['theme','block','borderColor']) . '; background-color: ' . $this->getdata(['theme','block','backgroundColor']).'}'; + // Bannière // Eléments communs @@ -2964,6 +2976,7 @@ class core extends common { 'content' => template::speech('La page ' . $accessInfo['pageId'] . ' est ouverte par l\'utilisateur ' . $accessInfo['userName'] . '') ]); } else { + $_SESSION['humanBot'] = 'bot'; if ( $this->getData(['locale','page403']) !== 'none' AND $this->getData(['page',$this->getData(['locale','page403'])])) { @@ -2977,6 +2990,7 @@ class core extends common { } } elseif ($this->output['content'] === '') { http_response_code(404); + $_SESSION['humanBot'] = 'bot'; if ( $this->getData(['locale','page404']) !== 'none' AND $this->getData(['page',$this->getData(['locale','page404'])])) { diff --git a/core/include/update.inc.php b/core/include/update.inc.php index f92935d..8ff7fab 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -66,4 +66,14 @@ if ($this->getData(['core', 'dataVersion']) < 4307) { // Mise à jour $this->setData(['core', 'dataVersion', 4307]); } + +if ($this->getData(['core', 'dataVersion']) < 4308) { + $this->setData(['config', 'connect', 'captchaBot', false]); + $this->setData(['locale', 'captchaSimpleText', 'Je ne suis pas un robot' ]); + $this->setData(['locale', 'captchaSimpleHelp', 'Cochez cette case pour prouver que vous n\'êtes pas un robot' ]); + $this->deleteData([ 'config', 'connect', 'captchaStrong' ]); + $this->deleteData([ 'config', 'connect', 'captchaType' ]); + // Mise à jour + $this->setData(['core', 'dataVersion', 4308]); +} ?> diff --git a/core/layout/common.css b/core/layout/common.css index 42ccf95..df3d1ad 100644 --- a/core/layout/common.css +++ b/core/layout/common.css @@ -1771,3 +1771,26 @@ th.col12 { display : none; } } + +figure.image { + display: inline-block; + border: 1px solid; + margin: 0 6px; +} + +figure.align-left { + float: left; +} + +figure.align-right { + float: right; +} + +figure.image img { + margin: 0; +} + +figure.image figcaption { + margin: 4px; + text-align: center; +} diff --git a/core/module/config/config.php b/core/module/config/config.php index 386a763..dc423e9 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -367,6 +367,8 @@ class config extends common { 'sitemapPageLabel' => empty($this->getInput('localeSitemapPageLabel', helper::FILTER_STRING_SHORT)) ? 'Plan du site' : $this->getInput('localeSitemapPageLabel', helper::FILTER_STRING_SHORT), 'metaDescription' => $this->getInput('localeMetaDescription', helper::FILTER_STRING_LONG, true), 'title' => $this->getInput('localeTitle', helper::FILTER_STRING_SHORT, true), + 'captchaSimpleText' => $this->getInput('localeCaptchaSimpleText', helper::FILTER_STRING_LONG), + 'captchaSimpleHelp' => $this->getInput('localeCaptchaSimpleHelp', helper::FILTER_STRING_LONG), 'cookies' => [ // Les champs sont obligatoires si l'option consentement des cookies est active 'cookiesDeltaText' => $this->getInput('localeCookiesDeltaText', helper::FILTER_STRING_LONG, $this->getData(['config', 'cookieConsent'])), @@ -425,9 +427,8 @@ class config extends common { 'log' => $this->getInput('connectLog',helper::FILTER_BOOLEAN), 'anonymousIp' => $this->getInput('connectAnonymousIp',helper::FILTER_INT), 'captcha' => $this->getInput('connectCaptcha',helper::FILTER_BOOLEAN), - 'captchaStrong' => $this->getInput('connectCaptchaStrong',helper::FILTER_BOOLEAN), - 'autoDisconnect' => $this->getInput('connectAutoDisconnect',helper::FILTER_BOOLEAN), - 'captchaType' => $this->getInput('connectCaptchaType') + 'captchaBot' => $this->getInput('connectCaptchaBot',helper::FILTER_BOOLEAN), + 'autoDisconnect' => $this->getInput('connectAutoDisconnect',helper::FILTER_BOOLEAN) ], 'i18n' => [ 'enable' => $this->getInput('localei18n',helper::FILTER_BOOLEAN), diff --git a/core/module/config/lang/en/lex_config.php b/core/module/config/lang/en/lex_config.php index 722e32b..9e12864 100644 --- a/core/module/config/lang/en/lex_config.php +++ b/core/module/config/lang/en/lex_config.php @@ -17,7 +17,7 @@ $text['core_config_view']['bodyheadscript'][2] = 'Script in body'; $text['core_config_view']['connect'][0] = 'Login security'; $text['core_config_view']['connect'][1] = 'Captcha at login'; $text['core_config_view']['connect'][2] = 'Complex captcha'; -$text['core_config_view']['connect'][3] = 'Recommended option to secure the connection. Applies to all captchas on the site. The simple captcha is limited to adding numbers from 0 to 10. The complex captcha uses four number operations from 0 to 20. Activation recommended.'; +$text['core_config_view']['connect'][3] = 'With this option if you are recognised as human a very simplified captcha will be displayed. This applies to all captchas on the site.'; $text['core_config_view']['connect'][4] = 'Captcha type'; $text['core_config_view']['connect'][5] = 'Automatic logout'; $text['core_config_view']['connect'][6] = 'Disconnects previously opened sessions on other browsers or terminals. Activation recommended.'; @@ -33,7 +33,7 @@ $text['core_config_view']['connect'][15] = 'Anonymise IP addresses'; $text['core_config_view']['connect'][16] = 'French regulations require level 2 anonymity'; $text['core_config_view']['connect'][17] = 'Download log'; $text['core_config_view']['connect'][18] = 'Reset log'; -$text['core_config_view']['connect'][19] ='Complex captcha'; +$text['core_config_view']['connect'][19] = 'Simple Captcha for humans'; $text['core_config_view']['index'][0] = 'Home'; $text['core_config_view']['index'][1] = 'Help'; $text['core_config_view']['index'][2] = 'Configuration'; @@ -85,6 +85,11 @@ $text['core_config_view']['locale'][38] = 'Enter the text of the checkbox for ac $text['core_config_view']['locale'][39] = 'Checkbox third party cookies'; $text['core_config_view']['locale'][40] = 'Validation button'; $text['core_config_view']['locale'][41] = 'Got it'; +$text['core_config_view']['locale'][42] = 'Simplified Captcha for humans '; +$text['core_config_view']['locale'][43] = 'Text associated with the checkbox'; +$text['core_config_view']['locale'][44] = 'I am not a robot'; +$text['core_config_view']['locale'][45] = 'Help message'; +$text['core_config_view']['locale'][46] = 'Check this box to prove that you are not a robot'; $text['core_config_view']['network'][0] = 'Settings'; $text['core_config_view']['network'][1] = 'Proxy type'; $text['core_config_view']['network'][2] = 'Proxy address'; diff --git a/core/module/config/lang/fr/lex_config.php b/core/module/config/lang/fr/lex_config.php index 432d93b..6436503 100644 --- a/core/module/config/lang/fr/lex_config.php +++ b/core/module/config/lang/fr/lex_config.php @@ -17,7 +17,7 @@ $text['core_config_view']['bodyheadscript'][2] = 'Script dans body'; $text['core_config_view']['connect'][0] = 'Sécurité de la connexion'; $text['core_config_view']['connect'][1] = 'Captcha à la connexion'; $text['core_config_view']['connect'][2] = 'Captcha complexe'; -$text['core_config_view']['connect'][3] = 'Option recommandée pour sécuriser la connexion. S\'applique à tous les captchas du site. Le captcha simple se limite à une addition de nombres de 0 à 10. Le captcha complexe utilise quatre opérations de nombres de 0 à 20. Activation recommandée.'; +$text['core_config_view']['connect'][3] = 'Avec cette option, si vous êtes reconnu comme humain, un captcha très simplifié sera affiché. Ceci s\'applique à tous les captchas du site.'; $text['core_config_view']['connect'][4] = 'Type de captcha'; $text['core_config_view']['connect'][5] = 'Déconnexion automatique'; $text['core_config_view']['connect'][6] = 'Déconnecte les sessions ouvertes précédemment sur d\'autres navigateurs ou terminaux. Activation recommandée.'; @@ -33,7 +33,7 @@ $text['core_config_view']['connect'][15] = 'Anonymat des adresses IP'; $text['core_config_view']['connect'][16] = 'La réglementation française impose un anonymat de niveau 2'; $text['core_config_view']['connect'][17] = 'Télécharger le journal'; $text['core_config_view']['connect'][18] = 'Réinitialiser le journal'; -$text['core_config_view']['connect'][19] ='Captcha complexe'; +$text['core_config_view']['connect'][19] = 'Captcha simple pour les humains'; $text['core_config_view']['index'][0] = 'Accueil'; $text['core_config_view']['index'][1] = 'Aide'; $text['core_config_view']['index'][2] = 'Configuration'; @@ -85,6 +85,11 @@ $text['core_config_view']['locale'][38] = 'Saisissez le texte de la case à coch $text['core_config_view']['locale'][39] = 'Checkbox cookies tiers'; $text['core_config_view']['locale'][40] = 'Bouton de validation'; $text['core_config_view']['locale'][41] = 'J\'ai compris'; +$text['core_config_view']['locale'][42] = 'Captcha simplifié pour les humains '; +$text['core_config_view']['locale'][43] = 'Texte associé à la checkbox'; +$text['core_config_view']['locale'][44] = 'Je ne suis pas un robot'; +$text['core_config_view']['locale'][45] = 'Message d\'aide'; +$text['core_config_view']['locale'][46] = 'Cochez cette case pour prouver que vous n\'êtes pas un robot'; $text['core_config_view']['network'][0] = 'Paramètres'; $text['core_config_view']['network'][1] = 'Type de proxy'; $text['core_config_view']['network'][2] = 'Adresse du proxy'; diff --git a/core/module/config/view/connect/connect.php b/core/module/config/view/connect/connect.php index 3229d62..df51363 100644 --- a/core/module/config/view/connect/connect.php +++ b/core/module/config/view/connect/connect.php @@ -19,18 +19,12 @@ include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdm 'checked' => $this->getData(['config', 'connect','captcha']) ]); ?> -
    - $this->getData(['config', 'connect', 'captchaStrong']), +
    + $this->getData(['config', 'connect', 'captchaBot']), 'help' => $text['core_config_view']['connect'][3] ]); ?>
    -
    - $text['core_config_view']['connect'][4], - 'selected' => $this->getData(['config', 'connect', 'captchaType']) - ]); ?> -
    $this->getData(['config','connect', 'autoDisconnect']), diff --git a/core/module/config/view/locale/locale.php b/core/module/config/view/locale/locale.php index f7fac1c..e3dc766 100644 --- a/core/module/config/view/locale/locale.php +++ b/core/module/config/view/locale/locale.php @@ -169,6 +169,35 @@ else{
    +
    +
    +
    +

    + + + + + +

    +
    +
    + $text['core_config_view']['locale'][43], + 'placeholder' => $text['core_config_view']['locale'][44], + 'value' => $this->getData(['locale', 'captchaSimpleText']) + ]); ?> +
    +
    + $text['core_config_view']['locale'][45], + 'placeholder' => $text['core_config_view']['locale'][46], + 'value' => $this->getData(['locale', 'captchaSimpleHelp']) + ]); ?> +
    +
    +
    +
    +
    diff --git a/core/module/config/view/setup/setup.php b/core/module/config/view/setup/setup.php index b916a40..d49501e 100644 --- a/core/module/config/view/setup/setup.php +++ b/core/module/config/view/setup/setup.php @@ -154,7 +154,7 @@ include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdm $listText ]); ?>
    @@ -181,7 +181,7 @@ include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdm } else{ $listModText .= "\n\n".$text['core_config_view']['setup'][33]; } - echo template::textarea('modulesPhp',[ + echo template::textarea('modulesPhp2',[ 'value' => $listModText ]); ?>
    diff --git a/core/module/install/ressource/database_en/base/locale.json b/core/module/install/ressource/database_en/base/locale.json index c89bb24..1f8346c 100644 --- a/core/module/install/ressource/database_en/base/locale.json +++ b/core/module/install/ressource/database_en/base/locale.json @@ -11,6 +11,8 @@ "sitemapPageLabel": "Site map", "metaDescription": "DeltaCMS is a database-less CMS that allows you to easily create and manage a website without any programming knowledge.", "title": "DeltaCMS", + "captchaSimpleText": "I'am not a robot", + "captchaSimpleHelp": "Check this box to prove that you are human", "cookies": { "cookiesDeltaText": "This site uses cookies which are necessary for its operation. They enable it to function more smoothly, for example by memorising connection data, the language you have chosen or the validation of this message.", "cookiesExtText": "", diff --git a/core/module/install/ressource/database_en/base/module.json b/core/module/install/ressource/database_en/base/module.json index ddf9e6d..69e6d75 100644 --- a/core/module/install/ressource/database_en/base/module.json +++ b/core/module/install/ressource/database_en/base/module.json @@ -5,7 +5,7 @@ "feeds": true, "feedsLabel": "Syndication RSS", "itemsperPage": 6, - "versionData": "6.3" + "versionData": "6.4" }, "texts": { "NoComment": "No comment yet", @@ -141,7 +141,7 @@ "logoUrl": "", "logoWidth": "40", "maxSizeUpload": "500000", - "versionData": "4.3", + "versionData": "4.4", "uploadJpg": true, "uploadPng": true, "uploadPdf": false, diff --git a/core/module/install/ressource/database_fr/base/locale.json b/core/module/install/ressource/database_fr/base/locale.json index 4a7d56c..d08aafa 100644 --- a/core/module/install/ressource/database_fr/base/locale.json +++ b/core/module/install/ressource/database_fr/base/locale.json @@ -11,6 +11,8 @@ "legalPageLabel": "Mentions légales", "metaDescription": "DeltaCMS est un CMS sans base de données qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation.", "title": "DeltaCMS", + "captchaSimpleText": "Je ne suis pas un robot", + "captchaSimpleHelp": "Cochez cette case pour prouver que vous êtes humain", "cookies": { "cookiesDeltaText": "Ce site utilise des cookies nécessaires à son fonctionnement, ils permettent de fluidifier son fonctionnement par exemple en mémorisant les données de connexion, la langue que vous avez choisie ou la validation de ce message.", "cookiesExtText": "", diff --git a/core/module/install/ressource/database_fr/base/module.json b/core/module/install/ressource/database_fr/base/module.json index dc53310..5849f20 100644 --- a/core/module/install/ressource/database_fr/base/module.json +++ b/core/module/install/ressource/database_fr/base/module.json @@ -5,7 +5,7 @@ "feeds": true, "feedsLabel": "Syndication RSS", "itemsperPage": 4, - "versionData": "6.3" + "versionData": "6.4" }, "texts": { "NoComment": "Pas encore de commentaire", @@ -141,7 +141,7 @@ "logoUrl": "", "logoWidth": "40", "maxSizeUpload": "1000000", - "versionData": "4.3", + "versionData": "4.4", "uploadJpg": true, "uploadPng": true, "uploadPdf": false, diff --git a/core/module/install/ressource/databaselight_en/base/locale.json b/core/module/install/ressource/databaselight_en/base/locale.json index 65e53a1..cd1f974 100644 --- a/core/module/install/ressource/databaselight_en/base/locale.json +++ b/core/module/install/ressource/databaselight_en/base/locale.json @@ -11,6 +11,8 @@ "legalPageLabel": "Legal Notices", "metaDescription": "DeltaCMS is a database-less CMS that allows you to easily create and manage a website without any programming knowledge.", "title": "DeltaCMS", + "captchaSimpleText": "I'am not a robot", + "captchaSimpleHelp": "Check this box to prove that you are human", "cookies": { "cookiesDeltaText": "This site uses cookies which are necessary for its operation. They enable it to function more smoothly, for example by memorising connection data, the language you have chosen or the validation of this message.", "cookiesExtText": "", diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 74e6fdc..0741145 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -38,9 +38,7 @@ class init extends common { 'log' => false, 'anonymousIp' => 2, 'captcha' => true, - 'captchaStrong' => false, - "captchaType" => 'num', - 'autoDisconnect' => true + 'captchaBot' => true ], 'i18n' => [ 'enable'=> true, @@ -70,7 +68,7 @@ class init extends common { ] ], 'core' => [ - 'dataVersion' => 4307, + 'dataVersion' => 4308, 'lastBackup' => 0, 'lastClearTmp' => 0, 'lastAutoUpdate' => 0, @@ -89,6 +87,8 @@ class init extends common { 'legalPageLabel' => 'Mentions légales', 'metaDescription' => 'DeltaCMS est un CMS sans base de données qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation.', 'title' => 'DeltaCMS', + 'captchaSimpleText' => 'Je ne suis pas un robot', + 'captchaSimpleHelp' => 'Cochez cette case pour prouver que vous êtes humain', 'cookies' => [ 'cookiesDeltaText' => 'Ce site utilise des cookies nécessaires à son fonctionnement, ils permettent de fluidifier son fonctionnement par exemple en mémorisant les données de connexion, la langue que vous avez choisie ou la validation de ce message.', 'cookiesExtText' => '', diff --git a/core/module/install/ressource/themes/theme_default.zip b/core/module/install/ressource/themes/theme_default.zip index 4bc9e6c..c25d0a9 100644 Binary files a/core/module/install/ressource/themes/theme_default.zip and b/core/module/install/ressource/themes/theme_default.zip differ diff --git a/core/module/install/ressource/themes/theme_hirondelles_960px.zip b/core/module/install/ressource/themes/theme_hirondelles_960px.zip index 9b85b73..25021e4 100644 Binary files a/core/module/install/ressource/themes/theme_hirondelles_960px.zip and b/core/module/install/ressource/themes/theme_hirondelles_960px.zip differ diff --git a/core/module/install/ressource/themes/theme_montagne_960px.zip b/core/module/install/ressource/themes/theme_montagne_960px.zip index e43e66e..ca97d5e 100644 Binary files a/core/module/install/ressource/themes/theme_montagne_960px.zip and b/core/module/install/ressource/themes/theme_montagne_960px.zip differ diff --git a/core/module/install/ressource/themes/theme_sansbanniere_fluide.zip b/core/module/install/ressource/themes/theme_sansbanniere_fluide.zip index 49ef8b4..c4006ef 100644 Binary files a/core/module/install/ressource/themes/theme_sansbanniere_fluide.zip and b/core/module/install/ressource/themes/theme_sansbanniere_fluide.zip differ diff --git a/core/module/theme/resource/custom.css b/core/module/theme/resource/custom.css index d1d4a08..04a3d1f 100644 --- a/core/module/theme/resource/custom.css +++ b/core/module/theme/resource/custom.css @@ -180,45 +180,57 @@ textarea:hover { /* Consentement aux cookies */ /* - #cookieConsent { - width: 80%; - color: #FFF; - background: #212223; - opacity: 0.9; - } #cookieConsent a{ - color : yellow; - } #cookieConsent h3{ - color : red; - } #cookieConsentConfirm { - background: rgba(0,0,255,1); - color: rgba(255,255,255,1); - } #cookieConsentConfirm:hover { - background: rgba(0,50,255,1); - color: rgba(255,255,255,1); - } */ + +/* Titre sous image */ + +/* +figure.image { + display: inline-block; + border: 1px solid gray; + margin: 0 6px; + background-color: #f5f2f0; +} + +figure.align-left { + float: left; +} + +figure.align-right { + float: right; +} + +figure.image img { + margin: 0; +} + +figure.image figcaption { + margin: 4px; + text-align: center; +} +*/ diff --git a/core/module/user/lang/en/lex_user.php b/core/module/user/lang/en/lex_user.php index 84bd9d4..e836be9 100644 --- a/core/module/user/lang/en/lex_user.php +++ b/core/module/user/lang/en/lex_user.php @@ -138,6 +138,7 @@ $text['core_user']['login'][9] = 'Captcha error'; $text['core_user']['login'][10] = 'Account locked '; $text['core_user']['login'][11] = 'Connection'; $text['core_user']['login'][12] = ''; +$text['core_user']['login'][13] = ' Fill in the Captcha '; $text['core_user']['logout'][0] = 'Successfully disconnected'; $text['core_user']['reset'][0] = 'Incorrect'; $text['core_user']['reset'][1] = 'New password registered'; diff --git a/core/module/user/lang/fr/lex_user.php b/core/module/user/lang/fr/lex_user.php index 50855d6..dddb428 100644 --- a/core/module/user/lang/fr/lex_user.php +++ b/core/module/user/lang/fr/lex_user.php @@ -138,6 +138,7 @@ $text['core_user']['login'][9] = 'Erreur de captcha'; $text['core_user']['login'][10] = 'Accès bloqué '; $text['core_user']['login'][11] = 'Connexion'; $text['core_user']['login'][12] = ''; +$text['core_user']['login'][13] = ' Renseignez le Captcha '; $text['core_user']['logout'][0] = 'Déconnexion réussie'; $text['core_user']['reset'][0] = 'Incorrect'; $text['core_user']['reset'][1] = 'Nouveau mot de passe enregistré'; diff --git a/core/module/user/user.php b/core/module/user/user.php index 2a4babd..4cfa989 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -405,14 +405,40 @@ class user extends common { if($this->isPost()) { // Lire Id du compte $userId = $this->getInput('userLoginId', helper::FILTER_ID, true); + $detectBot =''; + $captcha = true; // Check le captcha - if( - $this->getData(['config','connect','captcha']) - AND password_verify($this->getInput('userLoginCaptcha', helper::FILTER_INT), $this->getInput('userLoginCaptchaResult') ) === false ) - { - $captcha = false; - } else { - $captcha = true; + if( $this->getData(['config','connect','captcha']) ){ + $code =''; + if( isset( $_REQUEST['codeCaptcha'])) $code = strtoupper($_REQUEST['codeCaptcha']); + // option de détection de robot en premier cochée et $_SESSION['humanBot']==='human' + if( $_SESSION['humanBot']==='human' && $this->getData(['config', 'connect', 'captchaBot'])=== true ) { + // Présence des cookies et checkbox cochée ? + $detectBot ='bot'; + $captcha = false; + if ( isset ($_COOKIE['evtX']) && isset ($_COOKIE['evtO']) && isset ($_COOKIE['evtV']) && isset ($_COOKIE['evtA']) + && isset ($_COOKIE['evtH']) && isset ($_COOKIE['evtS']) && $this->getInput('userHumanCheck', helper::FILTER_BOOLEAN) === true ) { + // Calcul des intervals de temps + $time1 = 0; + if( isset ($_COOKIE['evtC'])) $time1 = $_COOKIE['evtC'] - $_COOKIE['evtO']; // temps entre fin de saisie et ouverture de la page + $time2 = $_COOKIE['evtH'] - $_COOKIE['evtO']; // temps entre click checkbox et ouverture de la page + $time3 = $_COOKIE['evtV'] - $_COOKIE['evtH']; // temps entre validation formulaire et click checkbox + $time4 = $_COOKIE['evtS'] - $_COOKIE['evtA']; // temps passé sur la checkbox + if( ( $time1 >= 1000 || ( isset ($_COOKIE['evtX']) && !isset ($_COOKIE['evtC']) ) ) && $time2 >= 1000 + && $time3 >=300 && $time4 >=300 && $this->getInput('userInputBlue')==='' ) { + $detectBot = 'human'; + $captcha = true; + } + } + // Bot présumé + if( $detectBot === 'bot') $_SESSION['humanBot']='bot'; + } + // $_SESSION['humanBot']==='bot' ou option 'Pas de Captcha pour un humain' non validée + elseif( md5($code) !== $_SESSION['captcha'] ) { + $captcha = false; + } else { + $captcha = true; + } } /** * Aucun compte existant @@ -501,6 +527,7 @@ class user extends common { // Sinon notification d'échec } else { $notification = $text['core_user']['login'][7]; + if( $detectBot = 'bot' ) $notification = $text['core_user']['login'][13]; $logStatus = $captcha === true ? $text['core_user']['login'][8] : $text['core_user']['login'][9]; // Cas 1 le nombre de connexions est inférieur aux tentatives autorisées : incrément compteur d'échec if ($this->getData(['user',$userId,'connectFail']) < $this->getData(['config', 'connect', 'attempt'])) { diff --git a/core/module/user/view/login/login.css b/core/module/user/view/login/login.css index e1afad0..5b5fba8 100644 --- a/core/module/user/view/login/login.css +++ b/core/module/user/view/login/login.css @@ -1 +1,20 @@ -/** vide */ \ No newline at end of file +.userCheckBlue { + display: none; +} +.userOuter{ + text-align: center; + margin: 0 auto; + width: 50%; + border-radius: 2px; + border: 1px solid; +} + +@media screen and (max-width: 768px) { + .userOuter{ + width: 100%; + } +} + +.userInner{ + display: inline-block; +} \ No newline at end of file diff --git a/core/module/user/view/login/login.js.php b/core/module/user/view/login/login.js.php new file mode 100644 index 0000000..83b73d2 --- /dev/null +++ b/core/module/user/view/login/login.js.php @@ -0,0 +1,79 @@ +/** + * This file is part of DeltaCMS. + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * @author Sylvain Lelièvre + * @copyright Copyright (C) 2021-2022, Sylvain Lelièvre + * @license GNU General Public License, version 3 + * @link https://deltacms.fr/ + * + * Delta was created from version 11.2.00.24 of ZwiiCMS + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2021, Frédéric Tempez + */ + + +/* Création et mise à jour du cookie sur modification d'un input */ +$( ".humanBot" ).mouseleave(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtC = " + time + ";SameSite=Strict"; +}); + +/* Cookie supplémentaire pour autoremplissage des champs */ +$( ".humanBot" ).change(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtX = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie à l'ouverture de la page formulaire*/ +$(document).ready(function(){ + const d = new Date(); + time = d.getTime(); + document.cookie = "evtO = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie à la validation de la checkbox 'je ne suis pas un robot'*/ +$( ".humanCheck" ).click(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtH = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie quand on arrive sur la checkbox 'je ne suis pas un robot' */ +$( ".humanCheck" ).mouseenter(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtA = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie quand on quitte la checkbox 'je ne suis pas un robot' */ +$( ".humanCheck" ).mouseleave(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtS = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie à la validation du formulaire */ +$( ".humanBotClose" ).click(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtV = " + time + ";SameSite=Strict"; +}); + +/* Affecter la couleur de bordure des blocs ou du fond à la class formOuter */ +$(document).ready(function(){ + borderColor = "getData(['theme', 'block', 'borderColor']); ?>"; + bgColor = "getData(['theme', 'site', 'backgroundColor']); ?>"; + $(".userOuter").css("border-color", borderColor); + /* Modifier la couleur au survol */ + $( ".userOuter" ).mouseenter(function() { + $(".userOuter").css("background-color", borderColor); + }); + $( ".userOuter" ).mouseleave(function() { + $(".userOuter").css("background-color", bgColor); + }); +}); diff --git a/core/module/user/view/login/login.php b/core/module/user/view/login/login.php index fe955a0..ceaa554 100644 --- a/core/module/user/view/login/login.php +++ b/core/module/user/view/login/login.php @@ -1,8 +1,10 @@ -getData(['config', 'i18n', 'langAdmin']) . '/lex_user.php'); + +echo template::formOpen('userLoginForm'); ?> -
    +
    $text['core_user_view']['login'][0], @@ -15,16 +17,32 @@ include('./core/module/user/lang/'. $this->getData(['config', 'i18n', 'langAdmin ]); ?>
    - getData(['config', 'connect','captcha'])): ?> -
    -
    - $this->getData(['config','connect', 'captchaStrong']), - 'type' => $this->getData(['config','connect', 'captchaType']) - ]); ?> + getData(['config', 'connect','captcha'])){ ?> + getData(['config', 'connect', 'captchaBot'])=== false ) { ?> +
    +
    + +
    -
    - + +
    + 'Input Blue', + 'value' => '' + ]); ?> +
    +
    +
    +
    + getData(['locale', 'captchaSimpleText']), [ + 'checked' => false, + 'help' => $this->getData(['locale', 'captchaSimpleHelp']), + 'required' => true + ]); ?> +
    +
    +
    +
    getData(['config', 'i18n', 'langAdmin
    -
    +
    helper::baseUrl() . str_replace('_', '/', str_replace('__', '#', $this->getUrl(2))), 'ico' => 'left', 'value' => $text['core_user_view']['login'][2] ]); ?>
    -
    +
    $text['core_user_view']['login'][3], 'ico' => 'lock' diff --git a/core/vendor/captcha/captcha.php b/core/vendor/captcha/captcha.php new file mode 100644 index 0000000..df7270c --- /dev/null +++ b/core/vendor/captcha/captcha.php @@ -0,0 +1,36 @@ + diff --git a/core/vendor/captcha/captcha.png b/core/vendor/captcha/captcha.png new file mode 100644 index 0000000..081d699 Binary files /dev/null and b/core/vendor/captcha/captcha.png differ diff --git a/core/vendor/captcha/polices/AnkeCall.woff b/core/vendor/captcha/polices/AnkeCall.woff new file mode 100644 index 0000000..a3f8bd4 Binary files /dev/null and b/core/vendor/captcha/polices/AnkeCall.woff differ diff --git a/core/vendor/captcha/polices/Eskiula.woff b/core/vendor/captcha/polices/Eskiula.woff new file mode 100644 index 0000000..804600b Binary files /dev/null and b/core/vendor/captcha/polices/Eskiula.woff differ diff --git a/core/vendor/captcha/polices/GLIMSTIC.woff b/core/vendor/captcha/polices/GLIMSTIC.woff new file mode 100644 index 0000000..688d45b Binary files /dev/null and b/core/vendor/captcha/polices/GLIMSTIC.woff differ diff --git a/core/vendor/captcha/polices/Ubuntu-MI.woff b/core/vendor/captcha/polices/Ubuntu-MI.woff new file mode 100644 index 0000000..c8c8658 Binary files /dev/null and b/core/vendor/captcha/polices/Ubuntu-MI.woff differ diff --git a/core/vendor/captcha/reload.png b/core/vendor/captcha/reload.png new file mode 100644 index 0000000..f5e7d82 Binary files /dev/null and b/core/vendor/captcha/reload.png differ diff --git a/core/vendor/tinymce/init.js b/core/vendor/tinymce/init.js index ceb24a8..f402101 100644 --- a/core/vendor/tinymce/init.js +++ b/core/vendor/tinymce/init.js @@ -77,8 +77,10 @@ tinymce.init({ {title: 'Une popup (Lity)', value: 'data-lity'}, {title: 'Une galerie d\'images (SimpleLightbox)', value: 'gallery'} ], - // Titre des image + // Titre des images image_title: true, + // figure html5 + image_caption: true, // Pages internes link_list: baseUrl + "core/vendor/tinymce/links.php", // Contenu du menu contextuel diff --git a/module/blog/blog.php b/module/blog/blog.php index 37a6c63..cd6d0e0 100644 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -18,7 +18,7 @@ class blog extends common { - const VERSION = '6.3'; + const VERSION = '6.4'; const REALNAME = 'Blog'; const DELETE = true; const UPDATE = '0.0'; @@ -290,20 +290,10 @@ class blog extends common { $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']); } unset($userFirstname); - // Passage de la langue d'administration à Tinymce et flatpickr - $lang_admin = $text['blog']['add'][2]; - $lang_flatpickr = $text['blog']['add'][3]; - ?> - - addOutput([ 'title' => $text['blog']['add'][1], 'vendor' => [ - 'tinymce', 'flatpickr' ], 'view' => 'add' @@ -702,25 +692,11 @@ class blog extends common { $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']) . ' (' . $groupEdits[$this->getData(['user', $userId, 'group'])] . ')'; } unset($userFirstname); - // Passage de la langue d'administration à Tinymce - $lang_admin = 'fr_FR'; - $lang_flatpickr = 'fr'; - if( $this->getData(['config', 'i18n', 'langAdmin']) ==='en'){ - $lang_admin = 'en_GB'; - $lang_flatpickr = 'default'; - } - ?> - - addOutput([ 'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']), 'vendor' => [ - 'flatpickr', - 'tinymce' + 'flatpickr' ], 'view' => 'edit' ]); @@ -781,67 +757,94 @@ class blog extends common { else { // Soumission du formulaire if($this->isPost()) { + $detectBot =''; // Check la captcha - if( - $this->getUser('password') !== $this->getInput('DELTA_USER_PASSWORD') - //AND $this->getInput('blogArticlecaptcha', helper::FILTER_INT) !== $this->getInput('blogArticlecaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('blogArticlecaptchaSecondNumber', helper::FILTER_INT)) - AND password_verify($this->getInput('blogArticleCaptcha', helper::FILTER_INT), $this->getInput('blogArticleCaptchaResult') ) === false ) - { - self::$inputNotices['blogArticleCaptcha'] = 'Incorrect'; - } - // Crée le commentaire - $key = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']); - if( $key === null ) $key=array(); - $commentId = helper::increment(uniqid(), $key); - $content = $this->getInput('blogArticleContent', false); - $this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentId, [ - 'author' => $this->getInput('blogArticleAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogArticleUserId')) ? TRUE : FALSE), - 'content' => $content, - 'createdOn' => time(), - 'userId' => $this->getInput('blogArticleUserId'), - 'approval' => !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication - ]]); - // Envoi d'une notification aux administrateurs - // Init tableau - $to = []; - // Liste des destinataires - 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']; + if( $this->getUser('password') !== $this->getInput('DELTA_USER_PASSWORD') ){ + $code = strtoupper($_REQUEST['codeCaptcha']); + // option de détection de robot en premier cochée et $_SESSION['humanBot']==='human' + if( $_SESSION['humanBot']==='human' && $this->getData(['config', 'connect', 'captchaBot'])=== true ) { + // Présence des 6 cookies et checkbox cochée ? + $detectBot ='bot'; + if ( isset ($_COOKIE['evtC']) && isset ($_COOKIE['evtO']) && isset ($_COOKIE['evtV']) && isset ($_COOKIE['evtA']) + && isset ($_COOKIE['evtH']) && isset ($_COOKIE['evtS']) && $this->getInput('blogHumanCheck', helper::FILTER_BOOLEAN) === true ) { + // Calcul des intervals de temps + $time1 = $_COOKIE['evtC'] - $_COOKIE['evtO']; // temps entre fin de saisie et ouverture de la page + $time2 = $_COOKIE['evtH'] - $_COOKIE['evtO']; // temps entre click checkbox et ouverture de la page + $time3 = $_COOKIE['evtV'] - $_COOKIE['evtH']; // temps entre validation formulaire et click checkbox + $time4 = $_COOKIE['evtS'] - $_COOKIE['evtA']; // temps passé sur la checkbox + if( $time1 >= 5000 && $time2 >= 1000 && $time3 >=300 + && $time4 >=300 && $this->getInput('blogInputBlue')==='' ) $detectBot = 'human'; + } + // Bot présumé + if( $detectBot === 'bot') $_SESSION['humanBot']='bot'; + } + // $_SESSION['humanBot']==='bot' ou option 'Pas de Captcha pour un humain' non validée + elseif( md5($code) !== $_SESSION['captcha'] ) + { + self::$inputNotices['blogArticleCaptcha'] = $text['blog']['index'][24]; } } - // Envoi du mail $sent code d'erreur ou de réussite - $notification = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) === true ? $this->getData(['module', $this->getUrl(0), 'texts', 'Waiting']): $this->getData(['module', $this->getUrl(0), 'texts', 'CommentOK']); - if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentNotification']) === true) { - $error = 0; - foreach($to as $key => $adress){ - $sent = $this->sendMail( - $adress, - $text['blog']['index'][4], - $text['blog']['index'][5] . ' ' . $firstname[$key] . ' ' . $lastname[$key] . ',

    ' . - $text['blog']['index'][6].'' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . ''.$text['blog']['index'][7].'

    ', - '' - ); - if( $sent === false) $error++; + if( $detectBot !== 'bot' ){ + // Crée le commentaire + $key = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']); + if( $key === null ) $key=array(); + $commentId = helper::increment(uniqid(), $key); + $content = $this->getInput('blogArticleContent', false); + $this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentId, [ + 'author' => $this->getInput('blogArticleAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogArticleUserId')) ? TRUE : FALSE), + 'content' => $content, + 'createdOn' => time(), + 'userId' => $this->getInput('blogArticleUserId'), + 'approval' => !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication + ]]); + // Envoi d'une notification aux administrateurs + // Init tableau + $to = []; + // Liste des destinataires + 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']; + } } - // Valeurs en sortie - $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl() . '#comment', - 'notification' => ($error === 0 ? $notification . $text['blog']['index'][0] : $notification . $text['blog']['index'][1] . $sent), - 'state' => ($sent === true ? true : null) - ]); + // Envoi du mail $sent code d'erreur ou de réussite + $notification = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) === true ? $this->getData(['module', $this->getUrl(0), 'texts', 'Waiting']): $this->getData(['module', $this->getUrl(0), 'texts', 'CommentOK']); + if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentNotification']) === true) { + $error = 0; + foreach($to as $key => $adress){ + $sent = $this->sendMail( + $adress, + $text['blog']['index'][4], + $text['blog']['index'][5] . ' ' . $firstname[$key] . ' ' . $lastname[$key] . ',

    ' . + $text['blog']['index'][6].'' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . ''.$text['blog']['index'][7].'

    ', + '' + ); + if( $sent === false) $error++; + } + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl() . '#comment', + 'notification' => ($error === 0 ? $notification . $text['blog']['index'][0] : $notification . $text['blog']['index'][1] . $sent), + 'state' => ($sent === true ? true : null) + ]); + } else { + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl() . '#comment', + 'notification' => $notification, + 'state' => true + ]); + } } else { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl() . '#comment', - 'notification' => $notification, - 'state' => true - ]); + 'notification' => $text['blog']['index'][25], + 'state' => false + ]); } - } // Ids des commentaires approuvés par ordre de publication $commentsApproved = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']); diff --git a/module/blog/lang/en/lex_blog.php b/module/blog/lang/en/lex_blog.php index 05a072f..a28bb5b 100644 --- a/module/blog/lang/en/lex_blog.php +++ b/module/blog/lang/en/lex_blog.php @@ -24,6 +24,9 @@ $text['blog_view']['add'][20] = 'Choice of maximum number of characters for each $text['blog_view']['add'][21] = 'Characters per comment'; $text['blog_view']['add'][22] = 'Email notification'; $text['blog_view']['add'][23] = 'Optional image'; +// For Tinymce and Flatpickr +$text['blog_view']['add'][24] = 'en_GB'; +$text['blog_view']['add'][25] = 'default'; $text['blog_view']['comment'][0] = 'Return'; $text['blog_view']['comment'][1] = 'Date'; $text['blog_view']['comment'][2] = 'Content'; @@ -68,6 +71,9 @@ $text['blog_view']['edit'][20] = 'Choice of the maximum number of characters for $text['blog_view']['edit'][21] = 'Characters per comment'; $text['blog_view']['edit'][22] = 'Email notification'; $text['blog_view']['edit'][23] = 'Editors = editors + administrators
    Members = members + editors + administrators'; +// For Tinymce and Flatpickr +$text['blog_view']['edit'][24] = 'en_GB'; +$text['blog_view']['edit'][25] = 'default'; $text['blog_view']['indext'][0] = 'Read more'; $text['blog_view']['indext'][1] = 'No article'; $text['blog_view']['texts'][0] = 'Back'; @@ -117,6 +123,8 @@ $text['blog']['index'][20] = 'Send'; $text['blog']['index'][21] = 'You have reached the maximum of'; $text['blog']['index'][22] = 'Characters left'; $text['blog']['index'][23] = 'You were about to exceed the maximum of'; +$text['blog']['index'][24] = 'Incorrect '; +$text['blog']['index'][25] = ' Repeat and fill in the Captcha '; $text['blog']['edit'][0] = 'Unauthorised action'; $text['blog']['edit'][1] = 'Changes saved'; $text['blog']['delete'][0] = 'Unauthorised action'; @@ -129,8 +137,6 @@ $text['blog']['texts'][1] = ''; $text['blog']['texts'][2] = 'Texts visible to a visitor'; $text['blog']['add'][0] = 'New article created'; $text['blog']['add'][1] = 'New article'; -$text['blog']['add'][2] = 'en_GB'; -$text['blog']['add'][3] = 'default'; $text['blog']['comment'][0] = 'Delete all'; $text['blog']['comment'][1] = 'Comment management : '; $text['blog']['commentDelete'][0] = 'Action not permitted'; diff --git a/module/blog/lang/fr/lex_blog.php b/module/blog/lang/fr/lex_blog.php index 02bb36b..71a2580 100644 --- a/module/blog/lang/fr/lex_blog.php +++ b/module/blog/lang/fr/lex_blog.php @@ -24,6 +24,9 @@ $text['blog_view']['add'][20] = 'Choix du nombre maximum de caractères pour cha $text['blog_view']['add'][21] = 'Caractères par commentaire'; $text['blog_view']['add'][22] = 'Notification par email'; $text['blog_view']['add'][23] = 'Image facultative'; +// pour Tinymce et Flatpickr +$text['blog_view']['add'][24] = 'fr_FR'; +$text['blog_view']['add'][25] = 'fr'; $text['blog_view']['comment'][0] = 'Retour'; $text['blog_view']['comment'][1] = 'Date'; $text['blog_view']['comment'][2] = 'Contenu'; @@ -68,6 +71,9 @@ $text['blog_view']['edit'][20] = 'Choix du nombre maximum de caractères pour ch $text['blog_view']['edit'][21] = 'Caractères par commentaire'; $text['blog_view']['edit'][22] = 'Notification par email'; $text['blog_view']['edit'][23] = 'Editeurs = éditeurs + administrateurs
    Membres = membres + éditeurs + administrateurs'; +// pour Tinymce et Flatpickr +$text['blog_view']['edit'][24] = 'fr_FR'; +$text['blog_view']['edit'][25] = 'fr'; $text['blog_view']['indext'][0] = 'Lire la suite'; $text['blog_view']['indext'][1] = 'Aucun article'; $text['blog_view']['texts'][0] = 'Retour'; @@ -117,6 +123,8 @@ $text['blog']['index'][20] = 'Envoyer'; $text['blog']['index'][21] = 'Vous avez atteint le maximum de'; $text['blog']['index'][22] = 'caractères restants'; $text['blog']['index'][23] = 'Vous alliez dépasser le maximum de '; +$text['blog']['index'][24] = 'Incorrect '; +$text['blog']['index'][25] = ' Recommencez et renseignez le Captcha '; $text['blog']['edit'][0] = 'Action non autorisée'; $text['blog']['edit'][1] = 'Modifications enregistrées'; $text['blog']['delete'][0] = 'Action non autorisée'; @@ -129,8 +137,6 @@ $text['blog']['texts'][1] = 'Textes enregistrés'; $text['blog']['texts'][2] = 'Textes visibles par un visiteur'; $text['blog']['add'][0] = 'Nouvel article créé'; $text['blog']['add'][1] = 'Nouvel article'; -$text['blog']['add'][2] = 'fr_FR'; -$text['blog']['add'][3] = 'fr'; $text['blog']['comment'][0] = 'Tout effacer'; $text['blog']['comment'][1] = 'Gestion des commentaires : '; $text['blog']['commentDelete'][0] = 'Action non autorisée'; diff --git a/module/blog/view/add/add.php b/module/blog/view/add/add.php index d9f6b0e..ad68285 100644 --- a/module/blog/view/add/add.php +++ b/module/blog/view/add/add.php @@ -3,6 +3,14 @@ $param = 'blog_view'; include('./module/blog/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_blog.php'); +// Passage de la langue d'administration à Tinymce et flatpickr +$lang_admin = $text['blog_view']['add'][24]; +$lang_flatpickr = $text['blog_view']['add'][25]; +?>'; +echo ''; +echo ''; + echo template::formOpen('blogAddForm'); ?>
    diff --git a/module/blog/view/article/article.css b/module/blog/view/article/article.css index 00b1246..554f3a6 100644 --- a/module/blog/view/article/article.css +++ b/module/blog/view/article/article.css @@ -61,3 +61,24 @@ display: inline; vertical-align: top; } +.blogCheckBlue { + display: none; +} + +.blogOuter{ + text-align: center; + margin: 0 auto; + width: 50%; + border-radius: 2px; + border: 1px solid; +} + +@media screen and (max-width: 768px) { + .blogOuter{ + width: 100%; + } +} + +.blogInner{ + display: inline-block; +} \ No newline at end of file diff --git a/module/blog/view/article/article.js.php b/module/blog/view/article/article.js.php index 945e62a..a0f26d3 100644 --- a/module/blog/view/article/article.js.php +++ b/module/blog/view/article/article.js.php @@ -47,3 +47,60 @@ $("#blogArticleCommentForm").on("submit", function() { $(location).attr("href", "#comment"); }); + +/* Création et mise à jour du cookie sur modification d'un input */ +$( ".humanBot" ).mouseleave(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtC = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie à l'ouverture de la page formulaire*/ +$(document).ready(function(){ + const d = new Date(); + time = d.getTime(); + document.cookie = "evtO = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie à la validation de la checkbox 'je ne suis pas un robot'*/ +$( ".humanCheck" ).click(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtH = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie quand on quitte la checkbox 'je ne suis pas un robot' */ +$( ".humanCheck" ).mouseleave(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtS = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie quand on arrive sur la checkbox 'je ne suis pas un robot' */ +$( ".humanCheck" ).mouseenter(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtA = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie à la validation du formulaire */ +$( ".humanBotClose" ).click(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtV = " + time + ";SameSite=Strict"; +}); + +/* Affecter la couleur de bordure des blocs à la class blogOuter */ +$(document).ready(function(){ + borderColor = "getData(['theme', 'block', 'borderColor']); ?>"; + bgColor = "getData(['theme', 'site', 'backgroundColor']); ?>"; + $(".blogOuter").css("border-color", borderColor); + /* Modifier la couleur au survol */ + $( ".blogOuter" ).mouseenter(function() { + $(".blogOuter").css("background-color", borderColor); + }); + $( ".blogOuter" ).mouseleave(function() { + $(".blogOuter").css("background-color", bgColor); + }); +}); + diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index 39678d9..efbccd8 100644 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -141,7 +141,7 @@ if( function_exists('datefmt_create') && function_exists('datefmt_create') && ex ]); ?>
    -
    +
    $this->getData(['module', $this->getUrl(0), 'texts', 'Name']) ]); ?> @@ -157,6 +157,7 @@ if( function_exists('datefmt_create') && function_exists('datefmt_create') && ex
    +
    $this->getData(['module', $this->getUrl(0), 'texts', 'Maxi']).' '.$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']).' '.$this->getData(['module', $this->getUrl(0), 'texts', 'Cara']), 'class' => 'editorWysiwygComment', @@ -167,16 +168,32 @@ if( function_exists('datefmt_create') && function_exists('datefmt_create') && ex 'TinymceExceed' => $this->getData(['module', $this->getUrl(0), 'texts', 'TinymceExceed']), 'caracteres' => $this->getData(['module', $this->getUrl(0), 'texts', 'Cara']) ]); ?> +
    getUser('password') !== $this->getInput('DELTA_USER_PASSWORD')): ?> -
    -
    - $this->getData(['config','connect', 'captchaStrong']), - 'type' => $this->getData(['config','connect', 'captchaType']) - ]); ?> + getData(['config', 'connect', 'captchaBot'])=== false ) { ?> +
    +
    + +
    -
    + +
    + 'Input Blue', + 'value' => '' + ]); ?> +
    +
    +
    +
    + getData(['locale', 'captchaSimpleText']), [ + 'checked' => false, + 'help' => $this->getData(['locale', 'captchaSimpleHelp']) + ]); ?> +
    +
    +
    @@ -185,7 +202,7 @@ if( function_exists('datefmt_create') && function_exists('datefmt_create') && ex 'value' => $this->getData(['module', $this->getUrl(0), 'texts', 'Cancel']) ]); ?>
    -
    +
    $this->getData(['module', $this->getUrl(0), 'texts', 'Send']), 'ico' => '' @@ -195,6 +212,10 @@ if( function_exists('datefmt_create') && function_exists('datefmt_create') && ex
    + +
    + +
    $comment): ?> diff --git a/module/blog/view/edit/edit.php b/module/blog/view/edit/edit.php index 72d24c3..ff3ce6f 100644 --- a/module/blog/view/edit/edit.php +++ b/module/blog/view/edit/edit.php @@ -3,6 +3,14 @@ $param = 'blog_view'; include('./module/blog/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_blog.php'); +// Passage de la langue d'administration à Tinymce et flatpickr +$lang_admin = $text['blog_view']['edit'][24]; +$lang_flatpickr = $text['blog_view']['edit'][25]; +?>'; +echo ''; +echo ''; + echo template::formOpen('blogEditForm'); ?>
    diff --git a/module/form/form.php b/module/form/form.php index ec14798..f7fa50b 100644 --- a/module/form/form.php +++ b/module/form/form.php @@ -18,7 +18,7 @@ class form extends common { - const VERSION = '4.3'; + const VERSION = '4.4'; const REALNAME = 'Formulaire'; const DELETE = true; const UPDATE = '0.0'; @@ -85,8 +85,8 @@ class form extends common { $this->setData(['module', $this->getUrl(0), 'config', 'uploadTxt',false]); $this->setData(['module', $this->getUrl(0), 'config', 'versionData','4.1']); } - if( version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '4.3', '<') ){ - $this->setData(['module', $this->getUrl(0), 'config', 'versionData', '4.3']); + if( version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '4.4', '<') ){ + $this->setData(['module', $this->getUrl(0), 'config', 'versionData', '4.4']); } } @@ -340,23 +340,42 @@ class form extends common { $this->update(); // Lexique $param = ''; + $detectBot =''; include('./module/form/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_form.php'); // Soumission du formulaire if($this->isPost()) { - // Check la captcha - 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 ) - { - self::$inputNotices['formCaptcha'] = $text['form']['index'][0]; - + $code = strtoupper($_REQUEST['codeCaptcha']); + // Captcha demandée + if( $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])){ + // option de détection de robot en premier cochée et $_SESSION['humanBot']==='human' + if( $_SESSION['humanBot']==='human' && $this->getData(['config', 'connect', 'captchaBot'])=== true ) { + // Présence des 6 cookies et checkbox cochée ? + $detectBot ='bot'; + if ( isset ($_COOKIE['evtC']) && isset ($_COOKIE['evtO']) && isset ($_COOKIE['evtV']) && isset ($_COOKIE['evtH']) + && isset ($_COOKIE['evtS']) && isset ($_COOKIE['evtA']) && $this->getInput('formHumanCheck', helper::FILTER_BOOLEAN) === true ) { + // Calcul des intervals de temps + $time1 = $_COOKIE['evtC'] - $_COOKIE['evtO']; // temps entre fin de saisie et ouverture de la page + $time2 = $_COOKIE['evtH'] - $_COOKIE['evtO']; // temps entre click checkbox et ouverture de la page + $time3 = $_COOKIE['evtV'] - $_COOKIE['evtH']; // temps entre validation formulaire et click checkbox + $time4 = $_COOKIE['evtS'] - $_COOKIE['evtA']; // temps passé sur la checkbox + if( $time1 >= 5000 && $time2 >= 1000 && $time3 >=300 && $time4 >=300 + && $this->getInput('formInputBlue')==='' ) $detectBot = 'human'; + } + // Bot présumé + if( $detectBot === 'bot') $_SESSION['humanBot']='bot'; + } + // $_SESSION['humanBot']==='bot' ou option 'Pas de Captcha pour un humain' non validée + //elseif( password_verify($this->getInput('formCaptcha', helper::FILTER_INT), $this->getInput('formCaptchaResult') ) === false ) + elseif( md5($code) !== $_SESSION['captcha'] ) + { + self::$inputNotices['formCaptcha'] = $text['form']['index'][0]; + } } // Préparation le contenu du mail $data = []; $replyTo = null; $content = ''; - // $notice concerne la pièce jointe + // $notice concerne la pièce jointe et le captcha $notice = ''; foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) { // Filtre la valeur @@ -476,6 +495,10 @@ class form extends common { // Préparation des données pour le mail $content .= '' . $this->getData(['module', $this->getUrl(0), 'input', $index, 'name']) . ' : ' . $value . '
    '; } + + // Bot présumé, la page sera actualisée avec l'affichage du captcha + if( $detectBot === 'bot') $notice = $text['form']['index'][12]; + // Si absence d'erreur sur la pièce jointe if( $notice === ''){ // Crée les données @@ -543,7 +566,7 @@ class form extends common { $sent = false; $redirect = helper::baseUrl() . $this->getUrl(0); } - + // Valeurs en sortie $this->addOutput([ 'notification' => ($sent === true ? $text['form']['index'][3] : $notice), diff --git a/module/form/lang/en/lex_form.php b/module/form/lang/en/lex_form.php index f655c19..2ec4113 100644 --- a/module/form/lang/en/lex_form.php +++ b/module/form/lang/en/lex_form.php @@ -72,6 +72,7 @@ $text['form']['index'][8] = 'Error while uploading file' ; $text['form']['index'][9] = 'failure, the message is not sent because '; $text['form']['index'][10] = 'The attachment is not a pdf document'; $text['form']['index'][11] = 'The attachment is not a zip document'; +$text['form']['index'][12] = ' Fill in the Captcha '; // Initialisation de flatpickr $lang_flatpickr = 'default'; // Selects diff --git a/module/form/lang/fr/lex_form.php b/module/form/lang/fr/lex_form.php index b5aeb6a..88ceade 100644 --- a/module/form/lang/fr/lex_form.php +++ b/module/form/lang/fr/lex_form.php @@ -72,6 +72,7 @@ $text['form']['index'][8] = 'Erreur pendant le téléversement du fichier'; $text['form']['index'][9] = 'échec le message n\'est pas envoyé car '; $text['form']['index'][10] = 'La pièce jointe n\'est pas un document pdf'; $text['form']['index'][11] = 'La pièce jointe n\'est pas un document zip'; +$text['form']['index'][12] = ' Renseignez le Captcha '; // Initialisation de flatpickr $lang_flatpickr = 'fr'; // Selects diff --git a/module/form/view/index/index.css b/module/form/view/index/index.css index 3dd4a04..5efbf29 100644 --- a/module/form/view/index/index.css +++ b/module/form/view/index/index.css @@ -34,6 +34,27 @@ .formInputFile { padding: 9px; border-radius: 2px; - border: 1px solid #D8DFE3; - backgroung-color: rgba(255,255,255,1); + border: 1px solid; +} + +.formOuter{ + text-align: center; + margin: 0 auto; + width: 50%; + border-radius: 2px; + border: 1px solid; +} + +@media screen and (max-width: 768px) { + .formOuter{ + width: 100%; + } +} + +.formInner{ + display: inline-block; +} + +.formCheckBlue { + display: none; } \ No newline at end of file diff --git a/module/form/view/index/index.js.php b/module/form/view/index/index.js.php index f176c16..2100baa 100644 --- a/module/form/view/index/index.js.php +++ b/module/form/view/index/index.js.php @@ -17,3 +17,61 @@ $( "#formFileReset" ).click(function() { $( "#fileToUpload" ).val(''); }); + +/* Création et mise à jour du cookie sur modification d'un input */ +$( ".humanBot" ).mouseleave(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtC = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie à l'ouverture de la page formulaire*/ +$(document).ready(function(){ + const d = new Date(); + time = d.getTime(); + document.cookie = "evtO = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie à la validation de la checkbox 'je ne suis pas un robot'*/ +$( ".humanCheck" ).click(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtH = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie quand on arrive sur la checkbox 'je ne suis pas un robot' */ +$( ".humanCheck" ).mouseenter(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtA = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie quand on quitte la checkbox 'je ne suis pas un robot' */ +$( ".humanCheck" ).mouseleave(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtS = " + time + ";SameSite=Strict"; +}); + +/* Création d'un cookie à la validation du formulaire */ +$( ".humanBotClose" ).click(function() { + const d = new Date(); + time = d.getTime(); + document.cookie = "evtV = " + time + ";SameSite=Strict"; +}); + +/* Affecter la couleur de bordure des blocs aux class formOuter et formInputFile */ +$(document).ready(function(){ + borderColor = "getData(['theme', 'block', 'borderColor']); ?>"; + bgColor = "getData(['theme', 'site', 'backgroundColor']); ?>"; + $(".formOuter").css("border-color", borderColor); + $(".formInputFile").css("border-color", borderColor); + /* Modifier la couleur au survol */ + $( ".formOuter" ).mouseenter(function() { + $(".formOuter").css("background-color", borderColor); + }); + $( ".formOuter" ).mouseleave(function() { + $(".formOuter").css("background-color", bgColor); + }); +}); + diff --git a/module/form/view/index/index.php b/module/form/view/index/index.php index 8ede827..62a5d47 100644 --- a/module/form/view/index/index.php +++ b/module/form/view/index/index.php @@ -5,6 +5,7 @@ include('./module/form/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . if($this->getData(['module', $this->getUrl(0), 'input'])): ?> +
    getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?> getData(['module', $this->getUrl(0), 'input'])): ?> - getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?> +
    + getData(['module', $this->getUrl(0), 'config', 'captcha']) + && ( $_SESSION['humanBot']==='bot') || $this->getData(['config', 'connect', 'captchaBot'])===false ): ?>
    - $this->getData(['config','connect', 'captchaStrong']), - 'type' => $this->getData(['config','connect', 'captchaType']) - ]); ?> +
    -
    -
    + getData(['module', $this->getUrl(0), 'config', 'captcha']) + && $_SESSION['humanBot']==='human' && $this->getData(['config', 'connect', 'captchaBot']) ): ?> +
    + 'Input Blue', + 'value' => '' + ]); ?> +
    +
    +
    +
    + getData(['locale', 'captchaSimpleText']), [ + 'checked' => false, + 'help' => $this->getData(['locale', 'captchaSimpleHelp']) + ]); ?> +
    +
    +
    + +
    +
    $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : $text['form_view']['index'][0], 'ico' => '' diff --git a/module/news/lang/en/lex_news.php b/module/news/lang/en/lex_news.php index f8cb56a..1566cde 100644 --- a/module/news/lang/en/lex_news.php +++ b/module/news/lang/en/lex_news.php @@ -45,6 +45,9 @@ $text['news_view']['add'][7] = 'The news can be consulted as soon as the publica $text['news_view']['add'][8] = 'Publication date'; $text['news_view']['add'][9] = 'The news is viewable until this date if specified. To cancel the unpublishing date, select a date before publication'; $text['news_view']['add'][10] = 'Unpublish date'; +// For Tinymce and Flatpickr +$text['news_view']['add'][12] = 'en_GB'; +$text['news_view']['add'][13] = 'default'; $text['news_view']['article'][0] = ' at '; $text['news_view']['article'][1] = 'Edit'; $text['news_view']['edit'][0] = 'Back'; @@ -58,11 +61,12 @@ $text['news_view']['edit'][7] = 'The news can be consulted as soon as the public $text['news_view']['edit'][8] = 'Publication date'; $text['news_view']['edit'][9] = 'The news is viewable until this date if specified. To cancel the unpublishing date, select a date before publication'; $text['news_view']['edit'][10] = 'Unpublish date'; +// For Tinymce and Flatpickr +$text['news_view']['edit'][12] = 'en_GB'; +$text['news_view']['edit'][13] = 'default'; + $text['news']['add'][0] = 'New news created'; $text['news']['add'][1] = 'New news'; -// For Tinymce and Flatpickr -$text['news']['add'][2] = 'en_GB'; -$text['news']['add'][3] = 'default'; $text['news']['config'][0] = 'Changes saved'; $text['news']['config'][1] = 'Permanent'; $text['news']['config'][2] = 'Module configuration'; @@ -74,9 +78,6 @@ $text['news']['delete'][0] = 'Unauthorised action'; $text['news']['delete'][1] = 'News deleted'; $text['news']['edit'][0] = 'Unauthorised action'; $text['news']['edit'][1] = 'Changes saved'; -// For Tinymce and Flatpickr -$text['news']['edit'][2] = 'en_GB'; -$text['news']['edit'][3] = 'default'; // Selects $states = [ false => 'Draft', diff --git a/module/news/lang/fr/lex_news.php b/module/news/lang/fr/lex_news.php index 96f8eec..e786e05 100644 --- a/module/news/lang/fr/lex_news.php +++ b/module/news/lang/fr/lex_news.php @@ -45,6 +45,9 @@ $text['news_view']['add'][7] = 'La news est consultable à partir du moment ou l $text['news_view']['add'][8] = 'Date de publication'; $text['news_view']['add'][9] = 'La news est consultable Jusqu\'à cette date si elle est spécifiée. Pour annuler la date de dépublication, sélectionnez une date antérieure à la publication.'; $text['news_view']['add'][10] = 'Date de dépublication'; +// Pour Tinymce et Flatpickr +$text['news_view']['add'][12] = 'fr_FR'; +$text['news_view']['add'][13] = 'fr'; $text['news_view']['article'][0] = ' à '; $text['news_view']['article'][1] = 'Editer'; $text['news_view']['edit'][0] = 'Retour'; @@ -58,11 +61,11 @@ $text['news_view']['edit'][7] = 'La news est consultable à partir du moment ou $text['news_view']['edit'][8] = 'Date de publication'; $text['news_view']['edit'][9] = 'La news est consultable Jusqu\'à cette date si elle est spécifiée. Pour annuler la date de dépublication, sélectionnez une date antérieure à la publication.'; $text['news_view']['edit'][10] = 'Date de dépublication'; +// Pour Tinymce et Flatpickr +$text['news_view']['edit'][12] = 'fr_FR'; +$text['news_view']['edit'][13] = 'fr'; $text['news']['add'][0] = 'Nouvelle news créée'; $text['news']['add'][1] = 'Nouvelle news'; -// Pour Tinymce et Flatpickr -$text['news']['add'][2] = 'fr_FR'; -$text['news']['add'][3] = 'fr'; $text['news']['config'][0] = 'Modifications enregistrées'; $text['news']['config'][1] = 'Permanent'; $text['news']['config'][2] = 'Configuration du module'; @@ -74,9 +77,6 @@ $text['news']['delete'][0] = 'Action non autorisée'; $text['news']['delete'][1] = 'News supprimée'; $text['news']['edit'][0] = 'Action non autorisée'; $text['news']['edit'][1] = 'Modifications enregistrées'; -// Pour Tinymce et Flatpickr -$text['news']['edit'][2] = 'fr_FR'; -$text['news']['edit'][3] = 'fr'; // Selects $states = [ false => 'Brouillon', diff --git a/module/news/news.php b/module/news/news.php index 2f0c3ba..be19948 100644 --- a/module/news/news.php +++ b/module/news/news.php @@ -18,7 +18,7 @@ class news extends common { - const VERSION = '4.2'; + const VERSION = '4.3'; const REALNAME = 'News'; const DELETE = true; const UPDATE = '0.0'; @@ -138,21 +138,11 @@ class news extends common { $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']); } unset($userFirstname); - // Passage de la langue d'administration à Tinymce et flatpickr - $lang_admin = $text['news']['add'][2]; - $lang_flatpickr = $text['news']['add'][3]; - ?> - - addOutput([ 'title' => $text['news']['add'][1], 'vendor' => [ - 'flatpickr', - 'tinymce' + 'flatpickr' ], 'view' => 'add' ]); @@ -380,21 +370,11 @@ class news extends common { $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']); } unset($userFirstname); - // Passage de la langue d'administration à Tinymce et flatpickr - $lang_admin = $text['news']['edit'][2]; - $lang_flatpickr = $text['news']['edit'][3]; - ?> - - addOutput([ 'title' => $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(2), 'title']), 'vendor' => [ - 'flatpickr', - 'tinymce' + 'flatpickr' ], 'view' => 'edit' ]); @@ -498,10 +478,12 @@ class news extends common { $arrayContent[$key] = str_replace('

    ', '', $arrayContent[$key]); if( strpos( $arrayContent[$key], '

    ') !== false){ $arrayContent[$key] = str_replace('

    ', '', $arrayContent[$key]); - } else { + } elseif( strpos( $arrayContent[$key], 'figure class=') === false) { $posfin = strpos( $arrayContent[$key], '>'); $substring = substr( $arrayContent[$key],0 , $posfin+1); $arrayContent[$key] = str_replace( $substring, '', $arrayContent[$key]); + }else{ + $arrayContent[$key] = str_replace( 'figure class="image"', 'figure class="image" style="margin:0"', $arrayContent[$key]); } } self::$news[$newsIds[$i]]['content'] .= $arrayContent[$key]; diff --git a/module/news/view/add/add.php b/module/news/view/add/add.php index 3009215..53ac285 100644 --- a/module/news/view/add/add.php +++ b/module/news/view/add/add.php @@ -2,6 +2,14 @@ // Lexique include('./module/news/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_news.php'); +// Passage de la langue d'administration à Tinymce et flatpickr +$lang_admin = $text['news_view']['add'][12]; +$lang_flatpickr = $text['news_view']['add'][13]; +?>'; +echo ''; +echo ''; + echo template::formOpen('newsAddForm'); ?>

    diff --git a/module/news/view/edit/edit.php b/module/news/view/edit/edit.php index 1542876..4d40edd 100644 --- a/module/news/view/edit/edit.php +++ b/module/news/view/edit/edit.php @@ -2,6 +2,14 @@ // Lexique include('./module/news/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_news.php'); +// Passage de la langue d'administration à Tinymce et flatpickr +$lang_admin = $text['news_view']['edit'][12]; +$lang_flatpickr = $text['news_view']['edit'][13]; +?>'; +echo ''; +echo ''; + echo template::formOpen('newsEditForm'); ?>
    diff --git a/module/statislite/include/stat.php b/module/statislite/include/stat.php index ce5491d..01e0dcf 100644 --- a/module/statislite/include/stat.php +++ b/module/statislite/include/stat.php @@ -1,7 +1,6 @@ -

    +
    - +

    - +

    -

    +