Modifications 4308

This commit is contained in:
Deltacms 2022-11-05 09:31:32 +01:00
parent 285a4170f7
commit 3dacfdbbef
60 changed files with 798 additions and 358 deletions

View File

@ -3,26 +3,12 @@
Require all denied Require all denied
</Files> </Files>
<IfModule mod_gzip.c>
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.*
</IfModule>
<IfModule mod_deflate.c> <IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/shtml AddOutputFilterByType DEFLATE text/shtml
AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE font/woff
AddOutputFilterByType DEFLATE font/woff2
AddOutputFilterByType DEFLATE application/font-woff
AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/rss+xml

View File

@ -1,9 +1,22 @@
# Changelog # 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 ## Version 4.3.07 de Deltacms
- Modifications : - Modifications :
- Configuration / Thème / Header : nouvelle option bannière visible uniquement sur la page d'accueil, - 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, - 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, - 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. - Configuration / Thème / Header : correction de plusieurs bugs notamment pour l'affichage en mode aperçu.

View File

@ -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. 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. L'administration du site est bilingue anglais ou français, le site peut être rédigé dans une des principales langues européennes.

View File

@ -35,120 +35,17 @@ class template {
/** /**
* Crée un champ captcha * Crée un champ captcha
* @param string $nameId Nom et id du champ * @param string $nameId Nom et id du champ
* @param array $attributes Attributs ($key => $value)
* @return string * @return string
*/ */
public static function captcha($nameId, array $attributes = []) { public static function captcha($nameId, $classWrapper) {
// Attributs par défaut
$attributes = array_merge([ $html = '<div id="' . $nameId . 'Wrapper" class="captcha inputWrapper ' . $classWrapper. '">';
'class' => '', $html .= '<img src="core/vendor/captcha/captcha.php" alt="Captcha" id="captcha">';
'classWrapper' => '', $html .= '<input name="codeCaptcha" type="text" size="9" style="position:relative;top:-40px;left:-10px;">';
'help' => '', $html .= '<img src="core/vendor/captcha/reload.png" alt="" style="cursor:pointer;position:relative;top:-30px;left:10px;width:24px;height:auto;"';
'id' => $nameId, $html .= ' onclick="document.images.captcha.src=\'core/vendor/captcha/captcha.php?id=\'+Math.round(Math.random(0)*1000)">';
'name' => $nameId, $html .= '</div>';
'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 = '<div id="' . $attributes['id'] . 'Wrapper" class="captcha inputWrapper ' . $attributes['classWrapper'] . '">';
// Label
$html .= self::label($attributes['id'],
'<img class="captcha' . ucFirst($attributes['type']) . '" src="' . helper::baseUrl(false) . 'site/tmp/' . $firstLetter . '.png" />&nbsp;<strong>' . $operator . '</strong>&nbsp;<img class="captcha' . ucFirst($attributes['type']) . '" src="' . helper::baseUrl(false) . 'site/tmp/' . $secondLetter . '.png" /><span style="font-size: 25px;"> = </span> ', [
'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(
'<input type="text" %s>',
helper::sprintAttributes($attributes)
);
// Champ résultat codé
$html .= self::hidden($attributes['id'] . 'Result', [
'value' => $result,
'before' => false
]);
// Fin du wrapper
$html .= '</div>';
// Retourne le html // Retourne le html
return $html; return $html;
} }
@ -171,8 +68,10 @@ class template {
'disabled' => false, 'disabled' => false,
'help' => '', 'help' => '',
'id' => $nameId, 'id' => $nameId,
'name' => $nameId 'name' => $nameId,
'required' => false
], $attributes); ], $attributes);
// Sauvegarde des données en cas d'erreur // Sauvegarde des données en cas d'erreur
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) { if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
$attributes['checked'] = (bool) common::$inputBefore[$attributes['id']]; $attributes['checked'] = (bool) common::$inputBefore[$attributes['id']];
@ -187,11 +86,20 @@ class template {
} }
$html .= self::notice($attributes['id'], $notice); $html .= self::notice($attributes['id'], $notice);
// Case à cocher // Case à cocher
$html .= sprintf( if( $attributes['required'] === false ){
'<input type="checkbox" value="%s" %s>', $html .= sprintf(
$value, '<input type="checkbox" value="%s" %s>',
helper::sprintAttributes($attributes) $value,
); helper::sprintAttributes($attributes)
);
} else {
$html .= sprintf(
'<input type="checkbox" value="%s" %s required>',
$value,
helper::sprintAttributes($attributes)
);
}
// Label // Label
$html .= self::label($attributes['id'], '<span>' . $label . '</span>', [ $html .= self::label($attributes['id'], '<span>' . $label . '</span>', [
'help' => $attributes['help'] 'help' => $attributes['help']

View File

@ -48,7 +48,7 @@ class common {
// Numéro de version // Numéro de version
const DELTA_UPDATE_URL = 'https://update.deltacms.fr/master/'; 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"; const DELTA_UPDATE_CHANNEL = "v4";
public static $actions = []; public static $actions = [];
@ -267,6 +267,15 @@ class common {
if($this->user === []) { if($this->user === []) {
$this->user = $this->getData(['user', $this->getInput('DELTA_USER_ID')]); $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 * Traduction du site par script
@ -1189,7 +1198,7 @@ class common {
$item .= '<h3>'. $this->getData(['locale', 'cookies', 'cookiesTitleText']) . '</h3>'; $item .= '<h3>'. $this->getData(['locale', 'cookies', 'cookiesTitleText']) . '</h3>';
$item .= '<p>' . $this->getData(['locale', 'cookies', 'cookiesDeltaText']) . '</p>'; $item .= '<p>' . $this->getData(['locale', 'cookies', 'cookiesDeltaText']) . '</p>';
// Formulaire de réponse // Formulaire de réponse
$item .= '<form method="POST" action="" id="cookieForm">'; $item .= '<form method="POST" id="cookieForm">';
$cookieExt = $this->getData(['locale', 'cookies', 'cookiesExtText']); $cookieExt = $this->getData(['locale', 'cookies', 'cookiesExtText']);
$stateCookieExt = $this->getInput('DELTA_COOKIE_EXT_CONSENT') === 'true' ? 'checked="checked"' : ''; $stateCookieExt = $this->getInput('DELTA_COOKIE_EXT_CONSENT') === 'true' ? 'checked="checked"' : '';
if( $cookieExt !== null AND $cookieExt !== '' ) { if( $cookieExt !== null AND $cookieExt !== '' ) {
@ -2162,11 +2171,11 @@ class common {
) ) { ) ) {
$select = ' class="i18nFlagSelected" '; $select = ' class="i18nFlagSelected" ';
} else { } else {
$select = ' class="i18nFlag" '; $select = ' class="i18nFlag flag" ';
} }
echo '<li>'; echo '<li>';
echo '<a href="' . helper::baseUrl() . 'translate/i18n/' . $key . '/' . $this->getData(['config', 'i18n',$key]) . '/' . $this->getUrl(0) . '"><img ' . $select . ' class="flag" alt="' . $value . '" src="' . helper::baseUrl(false) . 'core/vendor/i18n/png/' . $key . '.png"/></a>'; echo '<a href="' . helper::baseUrl() . 'translate/i18n/' . $key . '/' . $this->getData(['config', 'i18n',$key]) . '/' . $this->getUrl(0) . '"><img ' . $select . ' alt="' . $value . '" src="' . helper::baseUrl(false) . 'core/vendor/i18n/png/' . $key . '.png"/></a>';
echo '</li>'; echo '</li>';
} }
} }
@ -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 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 .= '.block p {margin: 0px -5px;}';
//$css .= '.mce-tinymce {border: 1px solid ' . $this->getdata(['theme','block','borderColor']) .' !important;}'; //$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 // Bannière
// Eléments communs // Eléments communs
@ -2964,6 +2976,7 @@ class core extends common {
'content' => template::speech('La page <strong>' . $accessInfo['pageId'] . '</strong> est ouverte par l\'utilisateur <strong>' . $accessInfo['userName'] . '</strong>') 'content' => template::speech('La page <strong>' . $accessInfo['pageId'] . '</strong> est ouverte par l\'utilisateur <strong>' . $accessInfo['userName'] . '</strong>')
]); ]);
} else { } else {
$_SESSION['humanBot'] = 'bot';
if ( $this->getData(['locale','page403']) !== 'none' if ( $this->getData(['locale','page403']) !== 'none'
AND $this->getData(['page',$this->getData(['locale','page403'])])) AND $this->getData(['page',$this->getData(['locale','page403'])]))
{ {
@ -2977,6 +2990,7 @@ class core extends common {
} }
} elseif ($this->output['content'] === '') { } elseif ($this->output['content'] === '') {
http_response_code(404); http_response_code(404);
$_SESSION['humanBot'] = 'bot';
if ( $this->getData(['locale','page404']) !== 'none' if ( $this->getData(['locale','page404']) !== 'none'
AND $this->getData(['page',$this->getData(['locale','page404'])])) AND $this->getData(['page',$this->getData(['locale','page404'])]))
{ {

View File

@ -66,4 +66,14 @@ if ($this->getData(['core', 'dataVersion']) < 4307) {
// Mise à jour // Mise à jour
$this->setData(['core', 'dataVersion', 4307]); $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]);
}
?> ?>

View File

@ -1771,3 +1771,26 @@ th.col12 {
display : none; 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;
}

View File

@ -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), '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), 'metaDescription' => $this->getInput('localeMetaDescription', helper::FILTER_STRING_LONG, true),
'title' => $this->getInput('localeTitle', helper::FILTER_STRING_SHORT, 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' => [ 'cookies' => [
// Les champs sont obligatoires si l'option consentement des cookies est active // Les champs sont obligatoires si l'option consentement des cookies est active
'cookiesDeltaText' => $this->getInput('localeCookiesDeltaText', helper::FILTER_STRING_LONG, $this->getData(['config', 'cookieConsent'])), '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), 'log' => $this->getInput('connectLog',helper::FILTER_BOOLEAN),
'anonymousIp' => $this->getInput('connectAnonymousIp',helper::FILTER_INT), 'anonymousIp' => $this->getInput('connectAnonymousIp',helper::FILTER_INT),
'captcha' => $this->getInput('connectCaptcha',helper::FILTER_BOOLEAN), 'captcha' => $this->getInput('connectCaptcha',helper::FILTER_BOOLEAN),
'captchaStrong' => $this->getInput('connectCaptchaStrong',helper::FILTER_BOOLEAN), 'captchaBot' => $this->getInput('connectCaptchaBot',helper::FILTER_BOOLEAN),
'autoDisconnect' => $this->getInput('connectAutoDisconnect',helper::FILTER_BOOLEAN), 'autoDisconnect' => $this->getInput('connectAutoDisconnect',helper::FILTER_BOOLEAN)
'captchaType' => $this->getInput('connectCaptchaType')
], ],
'i18n' => [ 'i18n' => [
'enable' => $this->getInput('localei18n',helper::FILTER_BOOLEAN), 'enable' => $this->getInput('localei18n',helper::FILTER_BOOLEAN),

View File

@ -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'][0] = 'Login security';
$text['core_config_view']['connect'][1] = 'Captcha at login'; $text['core_config_view']['connect'][1] = 'Captcha at login';
$text['core_config_view']['connect'][2] = 'Complex captcha'; $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'][4] = 'Captcha type';
$text['core_config_view']['connect'][5] = 'Automatic logout'; $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.'; $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'][16] = 'French regulations require level 2 anonymity';
$text['core_config_view']['connect'][17] = 'Download log'; $text['core_config_view']['connect'][17] = 'Download log';
$text['core_config_view']['connect'][18] = 'Reset 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'][0] = 'Home';
$text['core_config_view']['index'][1] = 'Help'; $text['core_config_view']['index'][1] = 'Help';
$text['core_config_view']['index'][2] = 'Configuration'; $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'][39] = 'Checkbox third party cookies';
$text['core_config_view']['locale'][40] = 'Validation button'; $text['core_config_view']['locale'][40] = 'Validation button';
$text['core_config_view']['locale'][41] = 'Got it'; $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'][0] = 'Settings';
$text['core_config_view']['network'][1] = 'Proxy type'; $text['core_config_view']['network'][1] = 'Proxy type';
$text['core_config_view']['network'][2] = 'Proxy address'; $text['core_config_view']['network'][2] = 'Proxy address';

View File

@ -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'][0] = 'Sécurité de la connexion';
$text['core_config_view']['connect'][1] = 'Captcha à la connexion'; $text['core_config_view']['connect'][1] = 'Captcha à la connexion';
$text['core_config_view']['connect'][2] = 'Captcha complexe'; $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'][4] = 'Type de captcha';
$text['core_config_view']['connect'][5] = 'Déconnexion automatique'; $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.'; $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'][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'][17] = 'Télécharger le journal';
$text['core_config_view']['connect'][18] = 'Réinitialiser 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'][0] = 'Accueil';
$text['core_config_view']['index'][1] = 'Aide'; $text['core_config_view']['index'][1] = 'Aide';
$text['core_config_view']['index'][2] = 'Configuration'; $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'][39] = 'Checkbox cookies tiers';
$text['core_config_view']['locale'][40] = 'Bouton de validation'; $text['core_config_view']['locale'][40] = 'Bouton de validation';
$text['core_config_view']['locale'][41] = 'J\'ai compris'; $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'][0] = 'Paramètres';
$text['core_config_view']['network'][1] = 'Type de proxy'; $text['core_config_view']['network'][1] = 'Type de proxy';
$text['core_config_view']['network'][2] = 'Adresse du proxy'; $text['core_config_view']['network'][2] = 'Adresse du proxy';

View File

@ -19,18 +19,12 @@ include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdm
'checked' => $this->getData(['config', 'connect','captcha']) 'checked' => $this->getData(['config', 'connect','captcha'])
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col6">
<?php echo template::checkbox('connectCaptchaStrong', true, $text['core_config_view']['connect'][19], [ <?php echo template::checkbox('connectCaptchaBot', true, $text['core_config_view']['connect'][19], [
'checked' => $this->getData(['config', 'connect', 'captchaStrong']), 'checked' => $this->getData(['config', 'connect', 'captchaBot']),
'help' => $text['core_config_view']['connect'][3] 'help' => $text['core_config_view']['connect'][3]
]); ?> ]); ?>
</div> </div>
<div class="col3">
<?php echo template::select('connectCaptchaType', $captchaTypes , [
'label' => $text['core_config_view']['connect'][4],
'selected' => $this->getData(['config', 'connect', 'captchaType'])
]); ?>
</div>
<div class="col3"> <div class="col3">
<?php echo template::checkbox('connectAutoDisconnect', true, $text['core_config_view']['connect'][5], [ <?php echo template::checkbox('connectAutoDisconnect', true, $text['core_config_view']['connect'][5], [
'checked' => $this->getData(['config','connect', 'autoDisconnect']), 'checked' => $this->getData(['config','connect', 'autoDisconnect']),

View File

@ -169,6 +169,35 @@ else{
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col12">
<div class="block">
<h4><?php echo $text['core_config_view']['locale'][42]; echo template::flag($flag, '20px');?>
<span id="labelHelpButton" class="helpDisplayButton">
<a href="https://doc.deltacms.fr/localisation#captcha" target="_blank">
<?php echo template::ico('help', 'left');?>
</a>
</span>
</h4>
<div class="row">
<div class="col6">
<?php echo template::text('localeCaptchaSimpleText', [
'label' => $text['core_config_view']['locale'][43],
'placeholder' => $text['core_config_view']['locale'][44],
'value' => $this->getData(['locale', 'captchaSimpleText'])
]); ?>
</div>
<div class="col6">
<?php echo template::text('localeCaptchaSimpleHelp', [
'label' => $text['core_config_view']['locale'][45],
'placeholder' => $text['core_config_view']['locale'][46],
'value' => $this->getData(['locale', 'captchaSimpleHelp'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<div class="block"> <div class="block">

View File

@ -154,7 +154,7 @@ include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdm
<?php $textRewrite = $text['core_config_view']['setup'][30]; <?php $textRewrite = $text['core_config_view']['setup'][30];
if( helper::checkRewrite() === true ) $textRewrite = $text['core_config_view']['setup'][29]; if( helper::checkRewrite() === true ) $textRewrite = $text['core_config_view']['setup'][29];
$listText = $text['core_config_view']['setup'][25]. common::DELTA_VERSION."\n".$text['core_config_view']['setup'][26]. phpversion()."\n".$text['core_config_view']['setup'][27]. $_SERVER['SERVER_SOFTWARE']."\n".$text['core_config_view']['setup'][28].$textRewrite; $listText = $text['core_config_view']['setup'][25]. common::DELTA_VERSION."\n".$text['core_config_view']['setup'][26]. phpversion()."\n".$text['core_config_view']['setup'][27]. $_SERVER['SERVER_SOFTWARE']."\n".$text['core_config_view']['setup'][28].$textRewrite;
echo template::textarea('modulesPhp',[ echo template::textarea('modulesPhp1',[
'value' => $listText 'value' => $listText
]); ?> ]); ?>
</div> </div>
@ -181,7 +181,7 @@ include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdm
} else{ } else{
$listModText .= "\n\n".$text['core_config_view']['setup'][33]; $listModText .= "\n\n".$text['core_config_view']['setup'][33];
} }
echo template::textarea('modulesPhp',[ echo template::textarea('modulesPhp2',[
'value' => $listModText 'value' => $listModText
]); ?> ]); ?>
</div> </div>

View File

@ -11,6 +11,8 @@
"sitemapPageLabel": "Site map", "sitemapPageLabel": "Site map",
"metaDescription": "DeltaCMS is a database-less CMS that allows you to easily create and manage a website without any programming knowledge.", "metaDescription": "DeltaCMS is a database-less CMS that allows you to easily create and manage a website without any programming knowledge.",
"title": "DeltaCMS", "title": "DeltaCMS",
"captchaSimpleText": "I'am not a robot",
"captchaSimpleHelp": "Check this box to prove that you are human",
"cookies": { "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.", "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": "", "cookiesExtText": "",

View File

@ -5,7 +5,7 @@
"feeds": true, "feeds": true,
"feedsLabel": "Syndication RSS", "feedsLabel": "Syndication RSS",
"itemsperPage": 6, "itemsperPage": 6,
"versionData": "6.3" "versionData": "6.4"
}, },
"texts": { "texts": {
"NoComment": "No comment yet", "NoComment": "No comment yet",
@ -141,7 +141,7 @@
"logoUrl": "", "logoUrl": "",
"logoWidth": "40", "logoWidth": "40",
"maxSizeUpload": "500000", "maxSizeUpload": "500000",
"versionData": "4.3", "versionData": "4.4",
"uploadJpg": true, "uploadJpg": true,
"uploadPng": true, "uploadPng": true,
"uploadPdf": false, "uploadPdf": false,

View File

@ -11,6 +11,8 @@
"legalPageLabel": "Mentions légales", "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.", "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", "title": "DeltaCMS",
"captchaSimpleText": "Je ne suis pas un robot",
"captchaSimpleHelp": "Cochez cette case pour prouver que vous êtes humain",
"cookies": { "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.", "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": "", "cookiesExtText": "",

View File

@ -5,7 +5,7 @@
"feeds": true, "feeds": true,
"feedsLabel": "Syndication RSS", "feedsLabel": "Syndication RSS",
"itemsperPage": 4, "itemsperPage": 4,
"versionData": "6.3" "versionData": "6.4"
}, },
"texts": { "texts": {
"NoComment": "Pas encore de commentaire", "NoComment": "Pas encore de commentaire",
@ -141,7 +141,7 @@
"logoUrl": "", "logoUrl": "",
"logoWidth": "40", "logoWidth": "40",
"maxSizeUpload": "1000000", "maxSizeUpload": "1000000",
"versionData": "4.3", "versionData": "4.4",
"uploadJpg": true, "uploadJpg": true,
"uploadPng": true, "uploadPng": true,
"uploadPdf": false, "uploadPdf": false,

View File

@ -11,6 +11,8 @@
"legalPageLabel": "Legal Notices", "legalPageLabel": "Legal Notices",
"metaDescription": "DeltaCMS is a database-less CMS that allows you to easily create and manage a website without any programming knowledge.", "metaDescription": "DeltaCMS is a database-less CMS that allows you to easily create and manage a website without any programming knowledge.",
"title": "DeltaCMS", "title": "DeltaCMS",
"captchaSimpleText": "I'am not a robot",
"captchaSimpleHelp": "Check this box to prove that you are human",
"cookies": { "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.", "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": "", "cookiesExtText": "",

View File

@ -38,9 +38,7 @@ class init extends common {
'log' => false, 'log' => false,
'anonymousIp' => 2, 'anonymousIp' => 2,
'captcha' => true, 'captcha' => true,
'captchaStrong' => false, 'captchaBot' => true
"captchaType" => 'num',
'autoDisconnect' => true
], ],
'i18n' => [ 'i18n' => [
'enable'=> true, 'enable'=> true,
@ -70,7 +68,7 @@ class init extends common {
] ]
], ],
'core' => [ 'core' => [
'dataVersion' => 4307, 'dataVersion' => 4308,
'lastBackup' => 0, 'lastBackup' => 0,
'lastClearTmp' => 0, 'lastClearTmp' => 0,
'lastAutoUpdate' => 0, 'lastAutoUpdate' => 0,
@ -89,6 +87,8 @@ class init extends common {
'legalPageLabel' => 'Mentions légales', '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.', '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', 'title' => 'DeltaCMS',
'captchaSimpleText' => 'Je ne suis pas un robot',
'captchaSimpleHelp' => 'Cochez cette case pour prouver que vous êtes humain',
'cookies' => [ '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.', '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' => '', 'cookiesExtText' => '',

View File

@ -180,45 +180,57 @@ textarea:hover {
/* Consentement aux cookies */ /* Consentement aux cookies */
/* /*
#cookieConsent { #cookieConsent {
width: 80%; width: 80%;
color: #FFF; color: #FFF;
background: #212223; background: #212223;
opacity: 0.9; opacity: 0.9;
} }
#cookieConsent a{ #cookieConsent a{
color : yellow; color : yellow;
} }
#cookieConsent h3{ #cookieConsent h3{
color : red; color : red;
} }
#cookieConsentConfirm { #cookieConsentConfirm {
background: rgba(0,0,255,1); background: rgba(0,0,255,1);
color: rgba(255,255,255,1); color: rgba(255,255,255,1);
} }
#cookieConsentConfirm:hover { #cookieConsentConfirm:hover {
background: rgba(0,50,255,1); background: rgba(0,50,255,1);
color: rgba(255,255,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;
}
*/

View File

@ -138,6 +138,7 @@ $text['core_user']['login'][9] = 'Captcha error';
$text['core_user']['login'][10] = 'Account locked '; $text['core_user']['login'][10] = 'Account locked ';
$text['core_user']['login'][11] = 'Connection'; $text['core_user']['login'][11] = 'Connection';
$text['core_user']['login'][12] = ''; $text['core_user']['login'][12] = '';
$text['core_user']['login'][13] = ' Fill in the Captcha ';
$text['core_user']['logout'][0] = 'Successfully disconnected'; $text['core_user']['logout'][0] = 'Successfully disconnected';
$text['core_user']['reset'][0] = 'Incorrect'; $text['core_user']['reset'][0] = 'Incorrect';
$text['core_user']['reset'][1] = 'New password registered'; $text['core_user']['reset'][1] = 'New password registered';

View File

@ -138,6 +138,7 @@ $text['core_user']['login'][9] = 'Erreur de captcha';
$text['core_user']['login'][10] = 'Accès bloqué '; $text['core_user']['login'][10] = 'Accès bloqué ';
$text['core_user']['login'][11] = 'Connexion'; $text['core_user']['login'][11] = 'Connexion';
$text['core_user']['login'][12] = ''; $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']['logout'][0] = 'Déconnexion réussie';
$text['core_user']['reset'][0] = 'Incorrect'; $text['core_user']['reset'][0] = 'Incorrect';
$text['core_user']['reset'][1] = 'Nouveau mot de passe enregistré'; $text['core_user']['reset'][1] = 'Nouveau mot de passe enregistré';

View File

@ -405,14 +405,40 @@ class user extends common {
if($this->isPost()) { if($this->isPost()) {
// Lire Id du compte // Lire Id du compte
$userId = $this->getInput('userLoginId', helper::FILTER_ID, true); $userId = $this->getInput('userLoginId', helper::FILTER_ID, true);
$detectBot ='';
$captcha = true;
// Check le captcha // Check le captcha
if( if( $this->getData(['config','connect','captcha']) ){
$this->getData(['config','connect','captcha']) $code ='';
AND password_verify($this->getInput('userLoginCaptcha', helper::FILTER_INT), $this->getInput('userLoginCaptchaResult') ) === false ) if( isset( $_REQUEST['codeCaptcha'])) $code = strtoupper($_REQUEST['codeCaptcha']);
{ // option de détection de robot en premier cochée et $_SESSION['humanBot']==='human'
$captcha = false; if( $_SESSION['humanBot']==='human' && $this->getData(['config', 'connect', 'captchaBot'])=== true ) {
} else { // Présence des cookies et checkbox cochée ?
$captcha = true; $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 * Aucun compte existant
@ -501,6 +527,7 @@ class user extends common {
// Sinon notification d'échec // Sinon notification d'échec
} else { } else {
$notification = $text['core_user']['login'][7]; $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]; $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 // 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'])) { if ($this->getData(['user',$userId,'connectFail']) < $this->getData(['config', 'connect', 'attempt'])) {

View File

@ -1 +1,20 @@
/** vide */ .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;
}

View File

@ -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 <lelievresylvain@free.fr>
* @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 <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @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 = "<?php echo $this->getData(['theme', 'block', 'borderColor']); ?>";
bgColor = "<?php echo $this->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);
});
});

View File

@ -1,8 +1,10 @@
<?php echo template::formOpen('userLoginForm'); <?php
// Lexique // Lexique
include('./core/module/user/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_user.php'); include('./core/module/user/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_user.php');
echo template::formOpen('userLoginForm');
?> ?>
<div class="row"> <div class="row humanBot">
<div class="col6"> <div class="col6">
<?php echo template::text('userLoginId', [ <?php echo template::text('userLoginId', [
'label' => $text['core_user_view']['login'][0], 'label' => $text['core_user_view']['login'][0],
@ -15,16 +17,32 @@ include('./core/module/user/lang/'. $this->getData(['config', 'i18n', 'langAdmin
]); ?> ]); ?>
</div> </div>
</div> </div>
<?php if ($this->getData(['config', 'connect','captcha'])): ?> <?php if ($this->getData(['config', 'connect','captcha'])){ ?>
<div class="row"> <?php if( ($_SESSION['humanBot']==='bot') || $this->getData(['config', 'connect', 'captchaBot'])=== false ) { ?>
<div class="col12 textAlignCenter"> <div class="row">
<?php echo template::captcha('userLoginCaptcha', [ <div class="col12 textAlignCenter">
'limit' => $this->getData(['config','connect', 'captchaStrong']), <?php echo template::captcha('userLoginCaptcha', ''); ?>
'type' => $this->getData(['config','connect', 'captchaType']) </div>
]); ?>
</div> </div>
</div> <?php } else { ?>
<?php endif;?> <div class="userCheckBlue">
<?php echo template::text('userInputBlue', [
'label' => 'Input Blue',
'value' => ''
]); ?>
</div>
<br>
<div class="userOuter">
<div class="userInner humanCheck">
<?php echo template::checkbox('userHumanCheck', true, $this->getData(['locale', 'captchaSimpleText']), [
'checked' => false,
'help' => $this->getData(['locale', 'captchaSimpleHelp']),
'required' => true
]); ?>
</div>
</div>
<br>
<?php } } ?>
<div class="row"> <div class="row">
<div class="col6"> <div class="col6">
<?php echo template::checkbox('userLoginLongTime', true, $text['core_user_view']['login'][4], [ <?php echo template::checkbox('userLoginLongTime', true, $text['core_user_view']['login'][4], [
@ -36,14 +54,14 @@ include('./core/module/user/lang/'. $this->getData(['config', 'i18n', 'langAdmin
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col3 offset6"> <div class="col4 offset4">
<?php echo template::button('userLoginBack', [ <?php echo template::button('userLoginBack', [
'href' => helper::baseUrl() . str_replace('_', '/', str_replace('__', '#', $this->getUrl(2))), 'href' => helper::baseUrl() . str_replace('_', '/', str_replace('__', '#', $this->getUrl(2))),
'ico' => 'left', 'ico' => 'left',
'value' => $text['core_user_view']['login'][2] 'value' => $text['core_user_view']['login'][2]
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col4 humanBotClose">
<?php echo template::submit('userLoginSubmit', [ <?php echo template::submit('userLoginSubmit', [
'value' => $text['core_user_view']['login'][3], 'value' => $text['core_user_view']['login'][3],
'ico' => 'lock' 'ico' => 'lock'

36
core/vendor/captcha/captcha.php vendored Normal file
View File

@ -0,0 +1,36 @@
<?php
session_start();
if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/');
function random($tab) {
return $tab[array_rand($tab)];
}
$chars = '0123456789';
$char1 = mt_rand( 0, strlen($chars) - 1 );
$char2 = mt_rand( 0, strlen($chars) - 1 );
$_SESSION['captcha'] = md5((int)$char1 + (int)$char2);
// polices utilisées
$fonts = glob('polices/*.woff');
// création de l'image captcha
$image = imagecreatefrompng('captcha.png');
// couleurs des caractères
$colors = array ( imagecolorallocate($image, 238, 238, 238),
imagecolorallocate($image, 51, 51, 51),
imagecolorallocate($image, 0, 102, 153),
imagecolorallocate($image, 204, 0, 51),
imagecolorallocate($image, 255, 51, 51),
imagecolorallocate($image, 51, 255, 51),
imagecolorallocate($image, 255, 255, 51) );
// positions, polices, caractères et couleurs randomisées
imagettftext($image, 28, -10, 7, 50, random($colors), ABSPATH .'/'. random($fonts), $char1);
imagettftext($image, 28, 0, 50, 50, random($colors), ABSPATH .'/'. 'polices/Eskiula.woff', '+');
imagettftext($image, 28, -35, 75, 50, random($colors), ABSPATH .'/'. random($fonts), $char2);
imagettftext($image, 28, 0, 125, 50, random($colors), ABSPATH .'/'. 'polices/Eskiula.woff', '=');
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);
?>

BIN
core/vendor/captcha/captcha.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

BIN
core/vendor/captcha/polices/Eskiula.woff vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
core/vendor/captcha/reload.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -77,8 +77,10 @@ tinymce.init({
{title: 'Une popup (Lity)', value: 'data-lity'}, {title: 'Une popup (Lity)', value: 'data-lity'},
{title: 'Une galerie d\'images (SimpleLightbox)', value: 'gallery'} {title: 'Une galerie d\'images (SimpleLightbox)', value: 'gallery'}
], ],
// Titre des image // Titre des images
image_title: true, image_title: true,
// figure html5
image_caption: true,
// Pages internes // Pages internes
link_list: baseUrl + "core/vendor/tinymce/links.php", link_list: baseUrl + "core/vendor/tinymce/links.php",
// Contenu du menu contextuel // Contenu du menu contextuel

View File

@ -18,7 +18,7 @@
class blog extends common { class blog extends common {
const VERSION = '6.3'; const VERSION = '6.4';
const REALNAME = 'Blog'; const REALNAME = 'Blog';
const DELETE = true; const DELETE = true;
const UPDATE = '0.0'; const UPDATE = '0.0';
@ -290,20 +290,10 @@ class blog extends common {
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']); $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']);
} }
unset($userFirstname); unset($userFirstname);
// Passage de la langue d'administration à Tinymce et flatpickr
$lang_admin = $text['blog']['add'][2];
$lang_flatpickr = $text['blog']['add'][3];
?>
<script>
var lang_admin = "<?php echo $lang_admin; ?>";
var lang_flatpickr = "<?php echo $lang_flatpickr; ?>";
</script>
<?php
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => $text['blog']['add'][1], 'title' => $text['blog']['add'][1],
'vendor' => [ 'vendor' => [
'tinymce',
'flatpickr' 'flatpickr'
], ],
'view' => 'add' 'view' => 'add'
@ -702,25 +692,11 @@ class blog extends common {
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']) . ' (' . $groupEdits[$this->getData(['user', $userId, 'group'])] . ')'; $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']) . ' (' . $groupEdits[$this->getData(['user', $userId, 'group'])] . ')';
} }
unset($userFirstname); 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';
}
?>
<script>
var lang_admin = "<?php echo $lang_admin; ?>";
var lang_flatpickr = "<?php echo $lang_flatpickr; ?>";
</script>
<?php
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']), 'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']),
'vendor' => [ 'vendor' => [
'flatpickr', 'flatpickr'
'tinymce'
], ],
'view' => 'edit' 'view' => 'edit'
]); ]);
@ -781,67 +757,94 @@ class blog extends common {
else { else {
// Soumission du formulaire // Soumission du formulaire
if($this->isPost()) { if($this->isPost()) {
$detectBot ='';
// Check la captcha // Check la captcha
if( if( $this->getUser('password') !== $this->getInput('DELTA_USER_PASSWORD') ){
$this->getUser('password') !== $this->getInput('DELTA_USER_PASSWORD') $code = strtoupper($_REQUEST['codeCaptcha']);
//AND $this->getInput('blogArticlecaptcha', helper::FILTER_INT) !== $this->getInput('blogArticlecaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('blogArticlecaptchaSecondNumber', helper::FILTER_INT)) // option de détection de robot en premier cochée et $_SESSION['humanBot']==='human'
AND password_verify($this->getInput('blogArticleCaptcha', helper::FILTER_INT), $this->getInput('blogArticleCaptchaResult') ) === false ) if( $_SESSION['humanBot']==='human' && $this->getData(['config', 'connect', 'captchaBot'])=== true ) {
{ // Présence des 6 cookies et checkbox cochée ?
self::$inputNotices['blogArticleCaptcha'] = 'Incorrect'; $detectBot ='bot';
} if ( isset ($_COOKIE['evtC']) && isset ($_COOKIE['evtO']) && isset ($_COOKIE['evtV']) && isset ($_COOKIE['evtA'])
// Crée le commentaire && isset ($_COOKIE['evtH']) && isset ($_COOKIE['evtS']) && $this->getInput('blogHumanCheck', helper::FILTER_BOOLEAN) === true ) {
$key = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']); // Calcul des intervals de temps
if( $key === null ) $key=array(); $time1 = $_COOKIE['evtC'] - $_COOKIE['evtO']; // temps entre fin de saisie et ouverture de la page
$commentId = helper::increment(uniqid(), $key); $time2 = $_COOKIE['evtH'] - $_COOKIE['evtO']; // temps entre click checkbox et ouverture de la page
$content = $this->getInput('blogArticleContent', false); $time3 = $_COOKIE['evtV'] - $_COOKIE['evtH']; // temps entre validation formulaire et click checkbox
$this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentId, [ $time4 = $_COOKIE['evtS'] - $_COOKIE['evtA']; // temps passé sur la checkbox
'author' => $this->getInput('blogArticleAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogArticleUserId')) ? TRUE : FALSE), if( $time1 >= 5000 && $time2 >= 1000 && $time3 >=300
'content' => $content, && $time4 >=300 && $this->getInput('blogInputBlue')==='' ) $detectBot = 'human';
'createdOn' => time(), }
'userId' => $this->getInput('blogArticleUserId'), // Bot présumé
'approval' => !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication if( $detectBot === 'bot') $_SESSION['humanBot']='bot';
]]); }
// Envoi d'une notification aux administrateurs // $_SESSION['humanBot']==='bot' ou option 'Pas de Captcha pour un humain' non validée
// Init tableau elseif( md5($code) !== $_SESSION['captcha'] )
$to = []; {
// Liste des destinataires self::$inputNotices['blogArticleCaptcha'] = $text['blog']['index'][24];
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'];
} }
} }
// Envoi du mail $sent code d'erreur ou de réussite if( $detectBot !== 'bot' ){
$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']); // Crée le commentaire
if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentNotification']) === true) { $key = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']);
$error = 0; if( $key === null ) $key=array();
foreach($to as $key => $adress){ $commentId = helper::increment(uniqid(), $key);
$sent = $this->sendMail( $content = $this->getInput('blogArticleContent', false);
$adress, $this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentId, [
$text['blog']['index'][4], 'author' => $this->getInput('blogArticleAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogArticleUserId')) ? TRUE : FALSE),
$text['blog']['index'][5] . ' <strong>' . $firstname[$key] . ' ' . $lastname[$key] . '</strong>,<br><br>' . 'content' => $content,
$text['blog']['index'][6].'<a href="' . helper::baseUrl() . $this->getUrl(0) . '/ ' . $this->getUrl(1) . '">' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . '</a>'.$text['blog']['index'][7].'<br><br>', '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
if( $sent === false) $error++; ]]);
// 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 // Envoi du mail $sent code d'erreur ou de réussite
$this->addOutput([ $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']);
'redirect' => helper::baseUrl() . $this->getUrl() . '#comment', if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentNotification']) === true) {
'notification' => ($error === 0 ? $notification . $text['blog']['index'][0] : $notification . $text['blog']['index'][1] . $sent), $error = 0;
'state' => ($sent === true ? true : null) foreach($to as $key => $adress){
]); $sent = $this->sendMail(
$adress,
$text['blog']['index'][4],
$text['blog']['index'][5] . ' <strong>' . $firstname[$key] . ' ' . $lastname[$key] . '</strong>,<br><br>' .
$text['blog']['index'][6].'<a href="' . helper::baseUrl() . $this->getUrl(0) . '/ ' . $this->getUrl(1) . '">' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . '</a>'.$text['blog']['index'][7].'<br><br>',
''
);
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 { } else {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl() . '#comment', 'redirect' => helper::baseUrl() . $this->getUrl() . '#comment',
'notification' => $notification, 'notification' => $text['blog']['index'][25],
'state' => true 'state' => false
]); ]);
} }
} }
// Ids des commentaires approuvés par ordre de publication // Ids des commentaires approuvés par ordre de publication
$commentsApproved = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']); $commentsApproved = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']);

View File

@ -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'][21] = 'Characters per comment';
$text['blog_view']['add'][22] = 'Email notification'; $text['blog_view']['add'][22] = 'Email notification';
$text['blog_view']['add'][23] = 'Optional image'; $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'][0] = 'Return';
$text['blog_view']['comment'][1] = 'Date'; $text['blog_view']['comment'][1] = 'Date';
$text['blog_view']['comment'][2] = 'Content'; $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'][21] = 'Characters per comment';
$text['blog_view']['edit'][22] = 'Email notification'; $text['blog_view']['edit'][22] = 'Email notification';
$text['blog_view']['edit'][23] = 'Editors = editors + administrators<br/> Members = members + editors + administrators'; $text['blog_view']['edit'][23] = 'Editors = editors + administrators<br/> 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'][0] = 'Read more';
$text['blog_view']['indext'][1] = 'No article'; $text['blog_view']['indext'][1] = 'No article';
$text['blog_view']['texts'][0] = 'Back'; $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'][21] = 'You have reached the maximum of';
$text['blog']['index'][22] = 'Characters left'; $text['blog']['index'][22] = 'Characters left';
$text['blog']['index'][23] = 'You were about to exceed the maximum of'; $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'][0] = 'Unauthorised action';
$text['blog']['edit'][1] = 'Changes saved'; $text['blog']['edit'][1] = 'Changes saved';
$text['blog']['delete'][0] = 'Unauthorised action'; $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']['texts'][2] = 'Texts visible to a visitor';
$text['blog']['add'][0] = 'New article created'; $text['blog']['add'][0] = 'New article created';
$text['blog']['add'][1] = 'New article'; $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'][0] = 'Delete all';
$text['blog']['comment'][1] = 'Comment management : '; $text['blog']['comment'][1] = 'Comment management : ';
$text['blog']['commentDelete'][0] = 'Action not permitted'; $text['blog']['commentDelete'][0] = 'Action not permitted';

View File

@ -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'][21] = 'Caractères par commentaire';
$text['blog_view']['add'][22] = 'Notification par email'; $text['blog_view']['add'][22] = 'Notification par email';
$text['blog_view']['add'][23] = 'Image facultative'; $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'][0] = 'Retour';
$text['blog_view']['comment'][1] = 'Date'; $text['blog_view']['comment'][1] = 'Date';
$text['blog_view']['comment'][2] = 'Contenu'; $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'][21] = 'Caractères par commentaire';
$text['blog_view']['edit'][22] = 'Notification par email'; $text['blog_view']['edit'][22] = 'Notification par email';
$text['blog_view']['edit'][23] = 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'; $text['blog_view']['edit'][23] = 'Editeurs = éditeurs + administrateurs<br/> 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'][0] = 'Lire la suite';
$text['blog_view']['indext'][1] = 'Aucun article'; $text['blog_view']['indext'][1] = 'Aucun article';
$text['blog_view']['texts'][0] = 'Retour'; $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'][21] = 'Vous avez atteint le maximum de';
$text['blog']['index'][22] = 'caractères restants'; $text['blog']['index'][22] = 'caractères restants';
$text['blog']['index'][23] = 'Vous alliez dépasser le maximum de '; $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'][0] = 'Action non autorisée';
$text['blog']['edit'][1] = 'Modifications enregistrées'; $text['blog']['edit'][1] = 'Modifications enregistrées';
$text['blog']['delete'][0] = 'Action non autorisée'; $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']['texts'][2] = 'Textes visibles par un visiteur';
$text['blog']['add'][0] = 'Nouvel article créé'; $text['blog']['add'][0] = 'Nouvel article créé';
$text['blog']['add'][1] = 'Nouvel article'; $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'][0] = 'Tout effacer';
$text['blog']['comment'][1] = 'Gestion des commentaires : '; $text['blog']['comment'][1] = 'Gestion des commentaires : ';
$text['blog']['commentDelete'][0] = 'Action non autorisée'; $text['blog']['commentDelete'][0] = 'Action non autorisée';

View File

@ -3,6 +3,14 @@
$param = 'blog_view'; $param = 'blog_view';
include('./module/blog/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_blog.php'); 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];
?><script> var lang_admin = "<?php echo $lang_admin; ?>"; var lang_flatpickr = "<?php echo $lang_flatpickr; ?>";</script><?php
echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/tinymce.min.js"></script>';
echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/init.js"></script>';
echo '<link rel="stylesheet" type ="text/css" href="'.helper::baseUrl(false).'core/vendor/tinymce/init.css">';
echo template::formOpen('blogAddForm'); ?> echo template::formOpen('blogAddForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col2">

View File

@ -61,3 +61,24 @@
display: inline; display: inline;
vertical-align: top; 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;
}

View File

@ -47,3 +47,60 @@ $("#blogArticleCommentForm").on("submit", function() {
$(location).attr("href", "#comment"); $(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 = "<?php echo $this->getData(['theme', 'block', 'borderColor']); ?>";
bgColor = "<?php echo $this->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);
});
});

View File

@ -141,7 +141,7 @@ if( function_exists('datefmt_create') && function_exists('datefmt_create') && ex
]); ?> ]); ?>
<?php else: ?> <?php else: ?>
<div class="row"> <div class="row">
<div class="col9"> <div class="col9 humanBot">
<?php echo template::text('blogArticleAuthor', [ <?php echo template::text('blogArticleAuthor', [
'label' => $this->getData(['module', $this->getUrl(0), 'texts', 'Name']) 'label' => $this->getData(['module', $this->getUrl(0), 'texts', 'Name'])
]); ?> ]); ?>
@ -157,6 +157,7 @@ if( function_exists('datefmt_create') && function_exists('datefmt_create') && ex
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="humanBot">
<?php echo template::textarea('blogArticleContent', [ <?php echo template::textarea('blogArticleContent', [
'label' => $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']), 'label' => $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', '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']), 'TinymceExceed' => $this->getData(['module', $this->getUrl(0), 'texts', 'TinymceExceed']),
'caracteres' => $this->getData(['module', $this->getUrl(0), 'texts', 'Cara']) 'caracteres' => $this->getData(['module', $this->getUrl(0), 'texts', 'Cara'])
]); ?> ]); ?>
</div>
<div id="blogArticleContentAlarm"> </div> <div id="blogArticleContentAlarm"> </div>
<?php if($this->getUser('password') !== $this->getInput('DELTA_USER_PASSWORD')): ?> <?php if($this->getUser('password') !== $this->getInput('DELTA_USER_PASSWORD')): ?>
<div class="row"> <?php if( ($_SESSION['humanBot']==='bot') || $this->getData(['config', 'connect', 'captchaBot'])=== false ) { ?>
<div class="col12"> <div class="row">
<?php echo template::captcha('blogArticleCaptcha', [ <div class="col12">
'limit' => $this->getData(['config','connect', 'captchaStrong']), <?php echo template::captcha('blogArticleCaptcha', ''); ?>
'type' => $this->getData(['config','connect', 'captchaType']) </div>
]); ?>
</div> </div>
</div> <?php } else { ?>
<div class="row blogCheckBlue">
<?php echo template::text('blogInputBlue', [
'label' => 'Input Blue',
'value' => ''
]); ?>
</div>
<br>
<div class="row blogOuter">
<div class="blogInner humanCheck">
<?php echo template::checkbox('blogHumanCheck', true, $this->getData(['locale', 'captchaSimpleText']), [
'checked' => false,
'help' => $this->getData(['locale', 'captchaSimpleHelp'])
]); ?>
</div>
</div>
<?php } ?>
<?php endif; ?> <?php endif; ?>
<div class="row"> <div class="row">
<div class="col2 offset8"> <div class="col2 offset8">
@ -185,7 +202,7 @@ if( function_exists('datefmt_create') && function_exists('datefmt_create') && ex
'value' => $this->getData(['module', $this->getUrl(0), 'texts', 'Cancel']) 'value' => $this->getData(['module', $this->getUrl(0), 'texts', 'Cancel'])
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col2 humanBotClose">
<?php echo template::submit('blogArticleSubmit', [ <?php echo template::submit('blogArticleSubmit', [
'value' => $this->getData(['module', $this->getUrl(0), 'texts', 'Send']), 'value' => $this->getData(['module', $this->getUrl(0), 'texts', 'Send']),
'ico' => '' 'ico' => ''
@ -195,6 +212,10 @@ if( function_exists('datefmt_create') && function_exists('datefmt_create') && ex
</div> </div>
<?php echo template::formClose(); ?> <?php echo template::formClose(); ?>
<?php endif;?> <?php endif;?>
<div class="pourTests"></div>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<?php foreach($module::$comments as $commentId => $comment): ?> <?php foreach($module::$comments as $commentId => $comment): ?>

View File

@ -3,6 +3,14 @@
$param = 'blog_view'; $param = 'blog_view';
include('./module/blog/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_blog.php'); 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];
?><script> var lang_admin = "<?php echo $lang_admin; ?>"; var lang_flatpickr = "<?php echo $lang_flatpickr; ?>";</script><?php
echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/tinymce.min.js"></script>';
echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/init.js"></script>';
echo '<link rel="stylesheet" type ="text/css" href="'.helper::baseUrl(false).'core/vendor/tinymce/init.css">';
echo template::formOpen('blogEditForm'); ?> echo template::formOpen('blogEditForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col2">

View File

@ -18,7 +18,7 @@
class form extends common { class form extends common {
const VERSION = '4.3'; const VERSION = '4.4';
const REALNAME = 'Formulaire'; const REALNAME = 'Formulaire';
const DELETE = true; const DELETE = true;
const UPDATE = '0.0'; 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', 'uploadTxt',false]);
$this->setData(['module', $this->getUrl(0), 'config', 'versionData','4.1']); $this->setData(['module', $this->getUrl(0), 'config', 'versionData','4.1']);
} }
if( version_compare($this->getData(['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.3']); $this->setData(['module', $this->getUrl(0), 'config', 'versionData', '4.4']);
} }
} }
@ -340,23 +340,42 @@ class form extends common {
$this->update(); $this->update();
// Lexique // Lexique
$param = ''; $param = '';
$detectBot ='';
include('./module/form/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_form.php'); include('./module/form/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_form.php');
// Soumission du formulaire // Soumission du formulaire
if($this->isPost()) { if($this->isPost()) {
// Check la captcha $code = strtoupper($_REQUEST['codeCaptcha']);
if( // Captcha demandée
$this->getData(['module', $this->getUrl(0), 'config', '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)) // option de détection de robot en premier cochée et $_SESSION['humanBot']==='human'
AND password_verify($this->getInput('formCaptcha', helper::FILTER_INT), $this->getInput('formCaptchaResult') ) === false ) if( $_SESSION['humanBot']==='human' && $this->getData(['config', 'connect', 'captchaBot'])=== true ) {
{ // Présence des 6 cookies et checkbox cochée ?
self::$inputNotices['formCaptcha'] = $text['form']['index'][0]; $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 // Préparation le contenu du mail
$data = []; $data = [];
$replyTo = null; $replyTo = null;
$content = ''; $content = '';
// $notice concerne la pièce jointe // $notice concerne la pièce jointe et le captcha
$notice = ''; $notice = '';
foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) { foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) {
// Filtre la valeur // Filtre la valeur
@ -476,6 +495,10 @@ class form extends common {
// Préparation des données pour le mail // Préparation des données pour le mail
$content .= '<strong>' . $this->getData(['module', $this->getUrl(0), 'input', $index, 'name']) . ' :</strong> ' . $value . '<br>'; $content .= '<strong>' . $this->getData(['module', $this->getUrl(0), 'input', $index, 'name']) . ' :</strong> ' . $value . '<br>';
} }
// 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 // Si absence d'erreur sur la pièce jointe
if( $notice === ''){ if( $notice === ''){
// Crée les données // Crée les données
@ -543,7 +566,7 @@ class form extends common {
$sent = false; $sent = false;
$redirect = helper::baseUrl() . $this->getUrl(0); $redirect = helper::baseUrl() . $this->getUrl(0);
} }
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'notification' => ($sent === true ? $text['form']['index'][3] : $notice), 'notification' => ($sent === true ? $text['form']['index'][3] : $notice),

View File

@ -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'][9] = 'failure, the message is not sent because ';
$text['form']['index'][10] = 'The attachment is not a pdf document'; $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'][11] = 'The attachment is not a zip document';
$text['form']['index'][12] = ' Fill in the Captcha ';
// Initialisation de flatpickr // Initialisation de flatpickr
$lang_flatpickr = 'default'; $lang_flatpickr = 'default';
// Selects // Selects

View File

@ -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'][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'][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'][11] = 'La pièce jointe n\'est pas un document zip';
$text['form']['index'][12] = ' Renseignez le Captcha ';
// Initialisation de flatpickr // Initialisation de flatpickr
$lang_flatpickr = 'fr'; $lang_flatpickr = 'fr';
// Selects // Selects

View File

@ -34,6 +34,27 @@
.formInputFile { .formInputFile {
padding: 9px; padding: 9px;
border-radius: 2px; border-radius: 2px;
border: 1px solid #D8DFE3; border: 1px solid;
backgroung-color: rgba(255,255,255,1); }
.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;
} }

View File

@ -17,3 +17,61 @@
$( "#formFileReset" ).click(function() { $( "#formFileReset" ).click(function() {
$( "#fileToUpload" ).val(''); $( "#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 = "<?php echo $this->getData(['theme', 'block', 'borderColor']); ?>";
bgColor = "<?php echo $this->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);
});
});

View File

@ -5,6 +5,7 @@ include('./module/form/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) .
if($this->getData(['module', $this->getUrl(0), 'input'])): ?> if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
<?php echo template::formOpenFile('formForm'); ?> <?php echo template::formOpenFile('formForm'); ?>
<div class="humanBot">
<?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?> <?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?>
<?php if($input['type'] === $module::TYPE_MAIL): ?> <?php if($input['type'] === $module::TYPE_MAIL): ?>
<?php echo template::mail('formInput[' . $index . ']', [ <?php echo template::mail('formInput[' . $index . ']', [
@ -59,18 +60,36 @@ if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?> </div>
<?php if( $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
&& ( $_SESSION['humanBot']==='bot') || $this->getData(['config', 'connect', 'captchaBot'])===false ): ?>
<div class="row"> <div class="row">
<div class="col12 textAlignCenter"> <div class="col12 textAlignCenter">
<?php echo template::captcha('formCaptcha', [ <?php echo template::captcha('formCaptcha', ''); ?>
'limit' => $this->getData(['config','connect', 'captchaStrong']),
'type' => $this->getData(['config','connect', 'captchaType'])
]); ?>
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="row"> <?php if( $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
<div class="col2 offset10"> && $_SESSION['humanBot']==='human' && $this->getData(['config', 'connect', 'captchaBot']) ): ?>
<div class="row formCheckBlue">
<?php echo template::text('formInputBlue', [
'label' => 'Input Blue',
'value' => ''
]); ?>
</div>
<br>
<div class="row formOuter">
<div class="formInner humanCheck">
<?php echo template::checkbox('formHumanCheck', true, $this->getData(['locale', 'captchaSimpleText']), [
'checked' => false,
'help' => $this->getData(['locale', 'captchaSimpleHelp'])
]); ?>
</div>
</div>
<br>
<?php endif; ?>
<div class="row textAlignCenter">
<div class="formInner humanBotClose">
<?php echo template::submit('formSubmit', [ <?php echo template::submit('formSubmit', [
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : $text['form_view']['index'][0], 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : $text['form_view']['index'][0],
'ico' => '' 'ico' => ''

View File

@ -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'][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'][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'; $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'][0] = ' at ';
$text['news_view']['article'][1] = 'Edit'; $text['news_view']['article'][1] = 'Edit';
$text['news_view']['edit'][0] = 'Back'; $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'][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'][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'; $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'][0] = 'New news created';
$text['news']['add'][1] = 'New news'; $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'][0] = 'Changes saved';
$text['news']['config'][1] = 'Permanent'; $text['news']['config'][1] = 'Permanent';
$text['news']['config'][2] = 'Module configuration'; $text['news']['config'][2] = 'Module configuration';
@ -74,9 +78,6 @@ $text['news']['delete'][0] = 'Unauthorised action';
$text['news']['delete'][1] = 'News deleted'; $text['news']['delete'][1] = 'News deleted';
$text['news']['edit'][0] = 'Unauthorised action'; $text['news']['edit'][0] = 'Unauthorised action';
$text['news']['edit'][1] = 'Changes saved'; $text['news']['edit'][1] = 'Changes saved';
// For Tinymce and Flatpickr
$text['news']['edit'][2] = 'en_GB';
$text['news']['edit'][3] = 'default';
// Selects // Selects
$states = [ $states = [
false => 'Draft', false => 'Draft',

View File

@ -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'][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'][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'; $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'][0] = ' à ';
$text['news_view']['article'][1] = 'Editer'; $text['news_view']['article'][1] = 'Editer';
$text['news_view']['edit'][0] = 'Retour'; $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'][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'][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'; $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'][0] = 'Nouvelle news créée';
$text['news']['add'][1] = 'Nouvelle news'; $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'][0] = 'Modifications enregistrées';
$text['news']['config'][1] = 'Permanent'; $text['news']['config'][1] = 'Permanent';
$text['news']['config'][2] = 'Configuration du module'; $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']['delete'][1] = 'News supprimée';
$text['news']['edit'][0] = 'Action non autorisée'; $text['news']['edit'][0] = 'Action non autorisée';
$text['news']['edit'][1] = 'Modifications enregistrées'; $text['news']['edit'][1] = 'Modifications enregistrées';
// Pour Tinymce et Flatpickr
$text['news']['edit'][2] = 'fr_FR';
$text['news']['edit'][3] = 'fr';
// Selects // Selects
$states = [ $states = [
false => 'Brouillon', false => 'Brouillon',

View File

@ -18,7 +18,7 @@
class news extends common { class news extends common {
const VERSION = '4.2'; const VERSION = '4.3';
const REALNAME = 'News'; const REALNAME = 'News';
const DELETE = true; const DELETE = true;
const UPDATE = '0.0'; const UPDATE = '0.0';
@ -138,21 +138,11 @@ class news extends common {
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']); $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']);
} }
unset($userFirstname); unset($userFirstname);
// Passage de la langue d'administration à Tinymce et flatpickr
$lang_admin = $text['news']['add'][2];
$lang_flatpickr = $text['news']['add'][3];
?>
<script>
var lang_admin = "<?php echo $lang_admin; ?>";
var lang_flatpickr = "<?php echo $lang_flatpickr; ?>";
</script>
<?php
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => $text['news']['add'][1], 'title' => $text['news']['add'][1],
'vendor' => [ 'vendor' => [
'flatpickr', 'flatpickr'
'tinymce'
], ],
'view' => 'add' 'view' => 'add'
]); ]);
@ -380,21 +370,11 @@ class news extends common {
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']); $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']);
} }
unset($userFirstname); unset($userFirstname);
// Passage de la langue d'administration à Tinymce et flatpickr
$lang_admin = $text['news']['edit'][2];
$lang_flatpickr = $text['news']['edit'][3];
?>
<script>
var lang_admin = "<?php echo $lang_admin; ?>";
var lang_flatpickr = "<?php echo $lang_flatpickr; ?>";
</script>
<?php
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(2), 'title']), 'title' => $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(2), 'title']),
'vendor' => [ 'vendor' => [
'flatpickr', 'flatpickr'
'tinymce'
], ],
'view' => 'edit' 'view' => 'edit'
]); ]);
@ -498,10 +478,12 @@ class news extends common {
$arrayContent[$key] = str_replace('</p>', '', $arrayContent[$key]); $arrayContent[$key] = str_replace('</p>', '', $arrayContent[$key]);
if( strpos( $arrayContent[$key], '<p>') !== false){ if( strpos( $arrayContent[$key], '<p>') !== false){
$arrayContent[$key] = str_replace('<p>', '', $arrayContent[$key]); $arrayContent[$key] = str_replace('<p>', '', $arrayContent[$key]);
} else { } elseif( strpos( $arrayContent[$key], 'figure class=') === false) {
$posfin = strpos( $arrayContent[$key], '>'); $posfin = strpos( $arrayContent[$key], '>');
$substring = substr( $arrayContent[$key],0 , $posfin+1); $substring = substr( $arrayContent[$key],0 , $posfin+1);
$arrayContent[$key] = str_replace( $substring, '', $arrayContent[$key]); $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]; self::$news[$newsIds[$i]]['content'] .= $arrayContent[$key];

View File

@ -2,6 +2,14 @@
// Lexique // Lexique
include('./module/news/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_news.php'); 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];
?><script> var lang_admin = "<?php echo $lang_admin; ?>"; var lang_flatpickr = "<?php echo $lang_flatpickr; ?>";</script><?php
echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/tinymce.min.js"></script>';
echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/init.js"></script>';
echo '<link rel="stylesheet" type ="text/css" href="'.helper::baseUrl(false).'core/vendor/tinymce/init.css">';
echo template::formOpen('newsAddForm'); ?> echo template::formOpen('newsAddForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col2">

View File

@ -2,6 +2,14 @@
// Lexique // Lexique
include('./module/news/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_news.php'); 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];
?><script> var lang_admin = "<?php echo $lang_admin; ?>"; var lang_flatpickr = "<?php echo $lang_flatpickr; ?>";</script><?php
echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/tinymce.min.js"></script>';
echo '<script src="'. helper::baseUrl(false).'core/vendor/tinymce/init.js"></script>';
echo '<link rel="stylesheet" type ="text/css" href="'.helper::baseUrl(false).'core/vendor/tinymce/init.css">';
echo template::formOpen('newsEditForm'); ?> echo template::formOpen('newsEditForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col2">

View File

@ -1,7 +1,6 @@
<?php <?php
/* /*
* Fichier stat.php inclut par le fichier body.inc.html * Ce fichier est inséré automatiquement après l'affichage du contenu de la page
* Depuis la version 2.2 l'inscription dans body.inc.html est automatique
*/ */
// Paramètres // Paramètres

View File

@ -113,7 +113,7 @@
.blockgraph{ .blockgraph{
border: 1px solid #D8DFE3; border: 1px solid #D8DFE3;
margin: 10px, 10px; margin: 10px 10px;
padding: 0; padding: 0;
background-color: #ffffff; background-color: #ffffff;
} }

View File

@ -134,15 +134,15 @@ if( function_exists('datefmt_create') && function_exists('datefmt_create') && ex
// Affichage des robots et des sessions invalides // Affichage des robots et des sessions invalides
$json = file_get_contents($module::$fichiers_json.'cumul.json'); $json = file_get_contents($module::$fichiers_json.'cumul.json');
$cumul = json_decode($json, true);?> $cumul = json_decode($json, true);?>
<br/><h3> <br/>
<div class="row"> <div class="row">
<div class="col4"> <div class="col4">
<?php echo $text['statislite_view']['index'][8].$cumul['robots']['ua']; ?> <h3><?php echo $text['statislite_view']['index'][8].$cumul['robots']['ua']; ?></h3>
</div> </div>
<div class="col4"> <div class="col4">
<?php echo $text['statislite_view']['index'][9].($cumul['robots']['np'] + $cumul['robots']['tv'] + $cumul['robots']['ue']);?> <h3><?php echo $text['statislite_view']['index'][9].($cumul['robots']['np'] + $cumul['robots']['tv'] + $cumul['robots']['ue']);?></h3>
</div> </div>
</div></h3> </div>
<!-- Fermeture bloc principal --> <!-- Fermeture bloc principal -->
</div> </div>