form 3.8 entité HTMl non décodée

This commit is contained in:
Fred Tempez 2023-03-25 18:24:16 +01:00
parent 471d28e4fe
commit 74684864f0
3 changed files with 117 additions and 107 deletions

View File

@ -853,7 +853,7 @@ class common
// Boucler sur les enfants et récupérer le tableau children avec la liste des enfants
foreach ($childIds as $childId) {
$children[] = [
'title' => ' » ' . html_entity_decode($this->getData(['page', $childId, 'shortTitle']), ENT_QUOTES),
'title' => ' » ' . html_entity_decode($this->getData(['page', $childId, 'shortTitle']), ENT_QUOTES),
'value' => $rewrite . $childId
];
}
@ -897,7 +897,7 @@ class common
// Enregistrement : 3 tentatives
for ($i = 0; $i < 3; $i++) {
if (file_put_contents('core/vendor/tinymce/link_list.json', json_encode($parents), LOCK_EX) !== false) {
if (file_put_contents('core/vendor/tinymce/link_list.json', json_encode($parents, JSON_UNESCAPED_UNICODE), LOCK_EX) !== false) {
break;
}
// Pause de 10 millisecondes
@ -1108,8 +1108,9 @@ class common
include 'core/layout/mail.php';
$layout = ob_get_clean();
$mail = new PHPMailer\PHPMailer\PHPMailer;
$mail->CharSet = 'UTF-8';
$mail->setLanguage(substr(self::$i18nUI, 0, 2), 'core/class/phpmailer/i18n/');
$mail->CharSet = 'UTF-8';
$mail->Encoding = 'base64';
// Mail
try {
// Paramètres SMTP perso
@ -1152,7 +1153,7 @@ class common
$mail->addAddress($to);
}
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Subject = html_entity_decode($subject);
$mail->Body = $layout;
$mail->AltBody = strip_tags($content);
if ($mail->send()) {

View File

@ -1,17 +1,19 @@
# Version 3.8
- Encode UTF-8 de l'objet du message, et des noms des champs.
# Version 3.7
- Modification liées à la suppression de flatpickr
- Modification liées à la suppression de flatpickr.
# Version 3.6
- Appel de fonction incorrect
- Appel de fonction incorrect.
# Version 3.5
- Multilingue
# Version 3.4
- Bug de présentation, une div en trop.
# Version 3.3
- Multilinguisme
- Multilinguisme.
# Version 3.2
- Bug variable non initialisée
- Bug variable non initialisée.
# Version 3.1
- Initialisation des paramètres personnalisés
- Initialisation des paramètres personnalisés.
# Version 3
- Déplacement des options de formulaires
- Gabarit du formulaire sur la page
- Déplacement des options de formulaires.
- Gabarit du formulaire sur la page.

View File

@ -14,9 +14,10 @@
* @link http://zwiicms.fr/
*/
class form extends common {
class form extends common
{
const VERSION = '3.7';
const VERSION = '3.8';
const REALNAME = 'Formulaire';
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
@ -105,7 +106,8 @@ class form extends common {
/**
* Configuration
*/
public function config() {
public function config()
{
// Mise à jour des données de module
$this->update();
@ -127,7 +129,7 @@ class form extends common {
$inputs = [];
foreach ($this->getInput('formConfigPosition', null) as $index => $position) {
$inputs[] = [
'name' => htmlspecialchars_decode($this->getInput('formConfigName[' . $index . ']'),ENT_QUOTES),
'name' => html_entity_decode($this->getInput('formConfigName[' . $index . ']')),
'position' => helper::filter($position, helper::FILTER_INT),
'required' => $this->getInput('formConfigRequired[' . $index . ']', helper::FILTER_BOOLEAN),
'type' => $this->getInput('formConfigType[' . $index . ']'),
@ -142,13 +144,6 @@ class form extends common {
'state' => true
]);
}
// Liste des pages
foreach($this->getHierarchy(null, false) as $parentPageId => $childrenPageIds) {
self::$pages[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
foreach($childrenPageIds as $childKey) {
self::$pages[$childKey] = '&nbsp;&nbsp;&nbsp;&nbsp;' . $this->getData(['page', $childKey, 'title']);
}
}
// Valeurs en sortie
$this->addOutput([
'title' => helper::translate('Configuration du module'),
@ -161,7 +156,8 @@ class form extends common {
}
public function option() {
public function option()
{
// Liste des utilisateurs
$userIdsFirstnames = helper::arrayColumn($this->getData(['user']), 'firstname');
ksort($userIdsFirstnames);
@ -189,7 +185,7 @@ class form extends common {
'user' => self::$listUsers[$this->getInput('formOptionUser', helper::FILTER_INT)],
'mail' => $this->getInput('formOptionMail'),
'pageId' => $this->getInput('formOptionPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formOptionPageId', helper::FILTER_ID) : '',
'subject' => $this->getInput('formOptionSubject'),
'subject' => html_entity_decode($this->getInput('formOptionSubject')),
'replyto' => $this->getInput('formOptionMailReplyTo', helper::FILTER_BOOLEAN),
'signature' => $this->getInput('formOptionSignature'),
'logoUrl' => $this->getInput('formOptionLogo'),
@ -211,10 +207,10 @@ class form extends common {
]);
} else {
// Liste des pages
foreach($this->getHierarchy(null, false) as $parentPageId => $childrenPageIds) {
foreach ($this->getHierarchy(null, true, false) as $parentPageId => $childrenPageIds) {
self::$pages[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
foreach ($childrenPageIds as $childKey) {
self::$pages[$childKey] = '&nbsp;&nbsp;&nbsp;&nbsp;' . $this->getData(['page', $childKey, 'title']);
self::$pages[$childKey] = '&nbsp;»&nbsp;' . $this->getData(['page', $childKey, 'title']);
}
}
// Valeurs en sortie
@ -232,7 +228,8 @@ class form extends common {
/**
* Données enregistrées
*/
public function data() {
public function data()
{
$data = $this->getData(['module', $this->getUrl(0), 'data']);
if ($data) {
// Pagination
@ -270,7 +267,8 @@ class form extends common {
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
*/
public function export2csv() {
public function export2csv()
{
// Jeton incorrect
if ($this->getUrl(2) !== $_SESSION['csrf']) {
// Valeurs en sortie
@ -310,7 +308,8 @@ class form extends common {
/**
* Suppression
*/
public function deleteall() {
public function deleteall()
{
// Jeton incorrect
if ($this->getUrl(2) !== $_SESSION['csrf']) {
// Valeurs en sortie
@ -345,7 +344,8 @@ class form extends common {
/**
* Suppression
*/
public function delete() {
public function delete()
{
// Jeton incorrect
if ($this->getUrl(3) !== $_SESSION['csrf']) {
// Valeurs en sortie
@ -380,7 +380,8 @@ class form extends common {
/**
* Accueil
*/
public function index() {
public function index()
{
// Mise à jour des données de module
$this->update();
@ -391,8 +392,8 @@ class form extends common {
if (
$this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
// AND $this->getInput('formcaptcha', helper::FILTER_INT) !== $this->getInput('formcaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('formcaptchaSecondNumber', helper::FILTER_INT))
AND password_verify($this->getInput('formCaptcha', helper::FILTER_INT), $this->getInput('formCaptchaResult') ) === false )
{
and password_verify($this->getInput('formCaptcha', helper::FILTER_INT), $this->getInput('formCaptchaResult')) === false
) {
self::$inputNotices['formCaptcha'] = helper::translate('Captcha incorrect');
}
@ -420,8 +421,10 @@ class form extends common {
}
$value = $this->getInput('formInput[' . $index . ']', $filter, $input['required']) === true ? 'X' : $this->getInput('formInput[' . $index . ']', $filter, $input['required']);
// premier champ email ajouté au mail en reply si option active
if ($this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true &&
$input['type'] === 'mail') {
if (
$this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true &&
$input['type'] === 'mail'
) {
$replyTo = $value;
}
// Préparation des données pour la création dans la base
@ -434,9 +437,11 @@ class form extends common {
// Envoi du mail
// Rechercher l'adresse en fonction du mail
$sent = true;
$singleuser = $this->getData(['user',
$singleuser = $this->getData([
'user',
$this->getData(['module', $this->getUrl(0), 'config', 'user']),
'mail']);
'mail'
]);
$singlemail = $this->getData(['module', $this->getUrl(0), 'config', 'mail']);
$group = $this->getData(['module', $this->getUrl(0), 'config', 'group']);
// Verification si le mail peut être envoyé
@ -507,7 +512,8 @@ class form extends common {
* Mise à jour du module
* Appelée par les fonctions index et config
*/
private function update() {
private function update()
{
// le module n'est pas initialisé
if ($this->getData(['module', $this->getUrl(0), 'config']) === NULL) {
@ -518,7 +524,8 @@ class form extends common {
/**
* Initialisation du thème d'un nouveau module
*/
private function init() {
private function init()
{
// Données du module absentes
require_once('module/form/ressource/defaultdata.php');
if ($this->getData(['module', $this->getUrl(0), 'config']) === null) {