$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' => ''
+ ]); ?>
+
+
+
+
+
+
+
$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 @@
-
+
+