diff --git a/module/blog/view/article/article.css b/module/blog/view/article/article.css index 763f8384..bec76899 100755 --- a/module/blog/view/article/article.css +++ b/module/blog/view/article/article.css @@ -45,6 +45,7 @@ font-size:0.8em; font-style: italic; color: grey; + height: 100%; } @media (max-width: 767px) { .blogArticlePicture { diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index aa19fe55..62263c9a 100755 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -1,66 +1,68 @@
-
-
- - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) - : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); - echo $date . ' à ' . $heure; - ?> -
+
+ getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?> + getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) == false) { + echo '' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . ''; + } ?> + getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?>
-
+
+
+
+ + + + getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) + ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) + : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); + $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) + ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) + : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); + echo $date . ' à ' . $heure; + ?> + getUser('password') === $this->getInput('ZWII_USER_PASSWORD') - AND - ( // Propriétaire - ( - $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER - AND ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'userId']) === $this->getUser('id') - OR $this->getUser('group') === self::GROUP_ADMIN ) + + $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') + AND + ( // Propriétaire + ( + $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER + AND ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'userId']) === $this->getUser('id') + OR $this->getUser('group') === self::GROUP_ADMIN ) + ) + OR ( + // Groupe + ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN + OR $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR) + AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) + ) + OR ( + // Tout le monde + $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL + AND $this->getUser('group') >= $module::$actions['config'] ) - OR ( - // Groupe - ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN - OR $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR) - AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) - ) - OR ( - // Tout le monde - $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL - AND $this->getUser('group') >= $module::$actions['config'] - ) - ) - ): ?> - helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'], - 'value' => 'Editer' - ]); ?> + ) + ): ?> + + Editer + + + + getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?> +
- getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?> - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) == false) { - echo '' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . ''; - } ?> -getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?> -

- -getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?> - - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?>

Cet article ne reçoit pas de commentaire.

diff --git a/module/download/download.php b/module/download/download.php index 10533d62..b63d067f 100644 --- a/module/download/download.php +++ b/module/download/download.php @@ -20,6 +20,7 @@ class download extends common { const UPDATE = '0.0'; const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json) + // Constantes du module const EDIT_OWNER = 'owner'; const EDIT_GROUP = 'group'; const EDIT_ALL = 'all'; @@ -98,6 +99,14 @@ class download extends common { ]; + public static $itemLicense = [ + 'none'=> 'Non définie', + 'cc' => 'Licence libre Creative Common, partage autorisé', + 'gnu' => 'Licence libre GNU, partage autorisé', + 'mit' => 'Licence libre MIT, partage autorisé', + 'owner' => 'Licence Propriétaire' + ]; + public static $users = []; /** @@ -189,6 +198,8 @@ class download extends common { 'file' => $this->getInput('downloadAddFile', helper::FILTER_STRING_SHORT, true), 'fileVersion' => $this->getInput('downloadAddFileVersion', helper::FILTER_STRING_SHORT, true), 'fileDate' => $this->getInput('downloadAddFileDate', helper::FILTER_DATETIME, true), + 'fileLicense' => $this->getInput('downloadAddFileLicense', helper::FILTER_STRING_SHORT, true), + 'fileAuthor' => $this->getInput('downloadAddFileAuthor', helper::FILTER_STRING_SHORT, true), 'fileStats' => [], 'publishedOn' => $this->getInput('downloadAddPublishedOn', helper::FILTER_DATETIME, true), 'state' => $this->getInput('downloadAddState', helper::FILTER_BOOLEAN), @@ -555,6 +566,8 @@ class download extends common { 'fileVersion' => $this->getInput('downloadEditFileVersion', helper::FILTER_STRING_SHORT, true), 'fileDate' => $this->getInput('downloadEditFileDate', helper::FILTER_DATETIME, true), 'fileStats' => $this->getData(['module',$this->getUrl(0), 'items', $this->getUrl(2), 'fileStats']), + 'fileLicense' => $this->getInput('downloadEditFileLicense', helper::FILTER_STRING_SHORT, true), + 'fileAuthor' => $this->getInput('downloadEditFileAuthor', helper::FILTER_STRING_SHORT, true), 'publishedOn' => $this->getInput('downloadEditPublishedOn', helper::FILTER_DATETIME, true), 'state' => $this->getInput('downloadEditState', helper::FILTER_BOOLEAN), 'title' => $this->getInput('downloadEditTitle', helper::FILTER_STRING_SHORT, true), diff --git a/module/download/view/add/add.php b/module/download/view/add/add.php index a4df7f10..b392a5ec 100644 --- a/module/download/view/add/add.php +++ b/module/download/view/add/add.php @@ -57,6 +57,20 @@ ]); ?>
+
+
+ 'Auteur', + 'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileAuthor']) + ]); ?> +
+
+ 'Licence', + 'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileLicense']) + ]); ?> +
+
diff --git a/module/download/view/edit/edit.php b/module/download/view/edit/edit.php index 7dc32b55..d80153ad 100644 --- a/module/download/view/edit/edit.php +++ b/module/download/view/edit/edit.php @@ -64,6 +64,20 @@ ]); ?> +
+
+ 'Auteur', + 'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileAuthor']) + ]); ?> +
+
+ 'Licence', + 'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileLicense']) + ]); ?> +
+
diff --git a/module/download/view/item/item.js.php b/module/download/view/item/item.js.php index 2748a7c8..3cda4b73 100644 --- a/module/download/view/item/item.js.php +++ b/module/download/view/item/item.js.php @@ -13,31 +13,31 @@ /** * Affiche le bloc pour rédiger un commentaire */ -var commentShowDOM = $("#downloaditemCommentShow"); +var commentShowDOM = $("#downloadItemCommentShow"); commentShowDOM.on("click focus", function() { - $("#downloaditemCommentShowWrapper").fadeOut(function() { - $("#downloaditemCommentWrapper").fadeIn(); - $("#downloaditemCommentContent").trigger("focus"); + $("#downloadItemCommentShowWrapper").fadeOut(function() { + $("#downloadItemCommentWrapper").fadeIn(); + $("#downloadItemCommentContent").trigger("focus"); }); }); -if($("#downloaditemCommentWrapper").find("textarea.notice,input.notice").length) { +if($("#downloadItemCommentWrapper").find("textarea.notice,input.notice").length) { commentShowDOM.trigger("click"); } /** * Cache le bloc pour rédiger un commentaire */ -$("#downloaditemCommentHide").on("click focus", function() { - $("#downloaditemCommentWrapper").fadeOut(function() { - $("#downloaditemCommentShowWrapper").fadeIn(); - $("#downloaditemCommentContent").val(""); - $("#downloaditemCommentAuthor").val(""); +$("#downloadItemCommentHide").on("click focus", function() { + $("#downloadItemCommentWrapper").fadeOut(function() { + $("#downloadItemCommentShowWrapper").fadeIn(); + $("#downloadItemCommentContent").val(""); + $("#downloadItemCommentAuthor").val(""); }); }); /** * Force le scroll vers les commentaires en cas d'erreur */ -$("#downloaditemCommentForm").on("submit", function() { +$("#downloadItemCommentForm").on("submit", function() { $(location).attr("href", "#comment"); }); \ No newline at end of file diff --git a/module/download/view/item/item.php b/module/download/view/item/item.php index 3173dbf9..4e3f770c 100644 --- a/module/download/view/item/item.php +++ b/module/download/view/item/item.php @@ -1,27 +1,32 @@ -
-
-
-
+
+
+
+
+ getData(['module', $this->getUrl(0),'items', $this->getUrl(1), 'content']); ?> +
+
+
+
+ getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])) : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])) + $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) + ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])) : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn']))); - echo $date . ' à ' . $heure; + echo $date . ' à ' . $heure; ?> -
-
-
- + getUser('password') === $this->getInput('ZWII_USER_PASSWORD') AND ( // Propriétaire ( - $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER - AND ( $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'userId']) === $this->getUser('id') - OR $this->getUser('group') === self::GROUP_ADMIN ) + $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER + AND ( $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'userId']) === $this->getUser('id') + OR $this->getUser('group') === self::GROUP_ADMIN ) ) OR ( // Groupe @@ -36,160 +41,171 @@ ) ) ): ?> - helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'], - 'value' => 'Editer' - ]); ?> - + + Editer + + + + getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?> + + +
-
-
-
-
- getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']); ?> - getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) . - '" alt="' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) . '">'; - ?> -
-
-
-
- self::FILE_DIR . 'source/' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'file']), - 'href' => helper::baseUrl() . $this->getUrl(0) . '/downloadFile/' . $this->getUrl(1) . '/' . $_SESSION['csrf'], - 'value' => 'Télécharger' - ]); ?> -
-
-
-
- getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileVersion']); ?> -
-
-
-
- getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileDate'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileDate'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileDate']))); - ?> - -
-
-
-
- Téléchargements : - - -
-
-
-
- getData(['module', $this->getUrl(0),'items', $this->getUrl(1), 'content']); ?> -
-
-

-
-
- - getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?> -
- - +
+
+ - - getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentClose'])): ?> -

Cet item ne reçoit pas de commentaire.

- -

- - - - 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?> -

- - 'Rédiger un commentaire...', - 'readonly' => true - ]); ?> -
- getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?> - 'Nom', - 'readonly' => true, - 'value' => $module::$editCommentSignature - ]); ?> - $this->getUser('id') - ]); ?> - -
-
- 'Nom' - ]); ?> -
-
-
Ou
-
-
- helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment', - 'value' => 'Connexion' - ]); ?> -
-
- - 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentMaxlength']).' caractères', - 'class' => 'editorWysiwygComment', - 'noDirty' => true, - 'maxlength' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentMaxlength']) - ]); ?> -
- getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?> -
-
- $this->getData(['config','captchaStrong']) - ]); ?> -
-
- -
-
- 'buttonGrey', - 'value' => 'Annuler' - ]); ?> -
-
- 'Envoyer', - 'ico' => '' - ]); ?> -
-
- -
-
- $comment): ?> -
-

- le - -

- +
+
+
+ self::FILE_DIR . 'source/' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'file']), + 'href' => helper::baseUrl() . $this->getUrl(0) . '/downloadFile/' . $this->getUrl(1) . '/' . $_SESSION['csrf'], + 'value' => 'Télécharger' + ]); ?> +
+
+
+
+ getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileVersion']); ?> +
+
+
+
+ getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileDate'])), 'UTF-8', true) + ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileDate'])) + : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileDate']))); + ?> + +
+
+
+
+ Auteur : + getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileAuthor']); ?> + +
+
+
+
+ Licence : + getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileLicense'])]; ?> + +
+
+
+
+ Téléchargements : + + +
- -
\ No newline at end of file + + +
+
+ getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentClose'])): ?> +

Cet item ne reçoit pas de commentaire.

+ +

+ + + + 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?> +

+ + 'Rédiger un commentaire...', + 'readonly' => true + ]); ?> +
+ getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?> + 'Nom', + 'readonly' => true, + 'value' => $module::$editCommentSignature + ]); ?> + $this->getUser('id') + ]); ?> + +
+
+ 'Nom' + ]); ?> +
+
+
Ou
+
+
+ helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment', + 'value' => 'Connexion' + ]); ?> +
+
+ + 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentMaxlength']).' caractères', + 'class' => 'editorWysiwygComment', + 'noDirty' => true, + 'maxlength' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentMaxlength']) + ]); ?> +
+ getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?> +
+
+ $this->getData(['config','captchaStrong']) + ]); ?> +
+
+ +
+
+ 'buttonGrey', + 'value' => 'Annuler' + ]); ?> +
+
+ 'Envoyer', + 'ico' => '' + ]); ?> +
+
+
+ +
+
+ $comment): ?> +
+

+ le + +

+ +
+
+
+
+ diff --git a/module/registration/registration.php b/module/registration/registration.php new file mode 100644 index 00000000..65d439cf --- /dev/null +++ b/module/registration/registration.php @@ -0,0 +1,388 @@ + + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + +class registration extends common { + + const VERSION = '1.0'; + const REALNAME = 'Auto-Inscription'; + const DELETE = true; + const UPDATE = '0.0'; + const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json) + + const STATUS_AWAITING = NULL; // En attente de validation du mail + const STATUS_VALIDATED = -2; // Mail validé en attente d'un admin + + public static $actions = [ + 'index' => self::GROUP_VISITOR, + 'validate' => self::GROUP_VISITOR, + 'config' => self::GROUP_ADMIN, + 'user' => self::GROUP_ADMIN, + 'delete' => self::GROUP_ADMIN, + 'edit' => self::GROUP_ADMIN + ]; + + public static $statusGroups = [ + self::STATUS_AWAITING => 'En attente', + self::STATUS_VALIDATED => 'Email validé', + ]; + + public static $timeLimit = [ + 2 => '2 minutes', + 5 => '5 minutes', + 10 => '10 minutes' + ]; + + public static $users = []; + + + + /** + * Liste des utilisateurs en attente + */ + public function user() { + $userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname'); + ksort($userIdsFirstnames); + foreach($userIdsFirstnames as $userId => $userFirstname) { + if ( $this->getData(['user',$userId,'group']) === self::STATUS_AWAITING || + $this->getData(['user',$userId,'group']) === self::STATUS_VALIDATED ) { + self::$users[] = [ + $userId, + $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']), + self::$statusGroups[$this->getData(['user', $userId, 'group'])] , + utf8_encode( date('Y-m-d G:i', $this->getData(['user', $userId, 'timer']))), + template::button('registrationUserEdit' . $userId, [ + 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $userId . '/' . $_SESSION['csrf'], + 'value' => template::ico('pencil') + ]), + template::button('registrationUserDelete' . $userId, [ + 'class' => 'userDelete buttonRed', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $userId . '/' . $_SESSION['csrf'], + 'value' => template::ico('cancel') + ]) + ]; + } + } + // Valeurs en sortie + $this->addOutput([ + 'title' => 'Demandes d\'inscription', + 'view' => 'user' + ]); + } + + + /** + * Édition + */ + public function edit() { + if ($this->getUrl(3) !== $_SESSION['csrf'] && + $this->getUrl(4) !== $_SESSION['csrf']) { + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . 'user', + 'notification' => 'Action non autorisée' + ]); + } + // Accès refusé + if( + // L'utilisateur n'existe pas + $this->getData(['user', $this->getUrl(2)]) === null + // Droit d'édition + AND ( + // Impossible de s'auto-éditer + ( + $this->getUser('id') === $this->getUrl(2) + AND $this->getUrl('group') <= self::GROUP_VISITOR + ) + // Impossible d'éditer un autre utilisateur + OR ($this->getUrl('group') < self::GROUP_MODERATOR) + ) + ) { + // Valeurs en sortie + $this->addOutput([ + 'access' => false + ]); + } + // Accès autorisé + else { + // Soumission du formulaire + if($this->isPost()) { + // Modification du groupe + $this->setData([ + 'user', + $this->getUrl(2), + [ + 'firstname' => $this->getData(['user',$this->getUrl(2),'firstname']), + 'forgot' => 0, + 'group' => $this->getInput('registrationUserEditGroup',helper::FILTER_INT), + 'lastname' => $this->getData(['user',$this->getUrl(2),'lastname']), + 'mail' => $this->getData(['user',$this->getUrl(2),'mail']), + 'password' => $this->getData(['user',$this->getUrl(2),'password']), + 'connectFail' => $this->getData(['user',$this->getUrl(2),'connectFail']), + 'connectTimeout' => $this->getData(['user',$this->getUrl(2),'connectTimeout']), + 'accessUrl' => $this->getData(['user',$this->getUrl(2),'accessUrl']), + 'accessTimer' => $this->getData(['user',$this->getUrl(2),'accessTimer']), + 'accessCsrf' => $this->getData(['user',$this->getUrl(2),'accessCsrf']) + ] + ]); + // Notifier le user uniquement si le groupe est membre au moins membre + if ($this->getInput('registrationUserEditGroup') >= 1 ) { + $this->sendMail( + $this->getData(['user',$this->getUrl(2),'mail']), + 'Approbation de l\'inscription', + '

' . $this->getdata(['module','registration',$this->getUrl(0),'config','mailValidateContent']) . '

' + + ); + } + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/user', + 'notification' => 'Modifications enregistrées', + 'state' => true + ]); + } + // Valeurs en sortie + $this->addOutput([ + 'title' => $this->getData(['user', $this->getUrl(2), 'firstname']) . ' ' . $this->getData(['user', $this->getUrl(2), 'lastname']), + 'view' => 'edit' + ]); + } + } + + + /** + * Suppression + */ + public function delete() { + // Accès refusé + if( + // L'utilisateur n'existe pas + $this->getData(['user', $this->getUrl(2)]) === null + // Groupe insuffisant + AND ($this->getUrl('group') < self::GROUP_MODERATOR) + ) { + // Valeurs en sortie + $this->addOutput([ + 'access' => false + ]); + } + // Jeton incorrect + elseif ($this->getUrl(3) !== $_SESSION['csrf']) { + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/user', + 'notification' => 'Action non autorisée' + ]); + } + // Bloque la suppression de son propre compte + elseif($this->getUser('id') === $this->getUrl(2)) { + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/user', + 'notification' => 'Impossible de supprimer votre propre compte' + ]); + } + // Suppression + else { + $this->deleteData(['user', $this->getUrl(2)]); + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/user', + 'notification' => 'Utilisateur supprimé', + 'state' => true + ]); + } + } + + + /** + * Ajout + */ + public function index() { + // Soumission du formulaire + if($this->isPost()) { + $check=true; + // L'identifiant d'utilisateur est indisponible + $userId = $this->getInput('registrationAddId', helper::FILTER_ID, true); + if($this->getData(['module','registration', $userId])) { + self::$inputNotices['registrationAddId'] = 'Identifiant déjà utilisé'; + $check=false; + } + // Double vérification pour le mot de passe + if($this->getInput('registrationAddPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('registrationAddConfirmPassword', helper::FILTER_STRING_SHORT, true)) { + self::$inputNotices['registrationAddConfirmPassword'] = 'Incorrect'; + $check = false; + } + // Le mail existe déjà + foreach($this->getData(['user']) as $usersId => $user) { + if($user['mail'] === $this->getInput('registrationAddMail', helper::FILTER_MAIL, true) ) { + self::$inputNotices['registrationAddMail'] = 'Mail déjà utilisé'; + $check = false; + break; + } + } + // Données de l'utilisateur + $userFirstname = $this->getInput('registrationAddFirstname', helper::FILTER_STRING_SHORT, true); + $userLastname = $this->getInput('registrationAddLastname', helper::FILTER_STRING_SHORT, true); + $userMail = $this->getInput('registrationAddMail', helper::FILTER_MAIL, true); + $userTimer = $this->getInput('registrationAddTimer', helper::FILTER_INT, true); + // Pas de nom saisi + if (empty($userFirstname) || + empty($userLastname) || + empty($this->getInput('registrationAddPassword', helper::FILTER_STRING_SHORT, true)) || + empty($this->getInput('registrationAddConfirmPassword', helper::FILTER_STRING_SHORT, true))) { + $check=false; + } + // Si tout est ok + if ($check === true) { + // création effective temporaire + $this->setData([ + 'user', + $userId, + [ + 'firstname' => $userFirstname, + 'lastname' => $userLastname, + 'mail' => $userMail, + 'password' => $this->getInput('registrationAddPassword', helper::FILTER_PASSWORD, true), + // pas de groupe afin de le différencier dans la liste des users + 'group' => null, + 'forgot' => 0, + 'timer' => $userTimer, + 'auth' => $_SESSION['csrf'], + 'status' => self::STATUS_AWAITING + ] + ]); + // Mail d'avertissement aux administrateurs + // Utilisateurs dans le groupe admin + $to = []; + foreach($this->getData(['user']) as $userId => $user) { + if($user['group'] == self::GROUP_ADMIN) { + $to[] = $user['mail']; + } + } + // Envoi du mail + if($to) { + $messageAdmin = $this->getdata(['module','registration',$this->getUrl(0),'config','state']) ? 'Une demande d\'inscription attend l`approbation d\'un administrateur.' : 'Un nouveau membre s\'est inscrit.'; + // Envoi le mail + $this->sendMail( + $to, + 'Auto-inscription sur le site ' . $this->getData(['config', 'title']), + '

' . $messageAdmin . '

' . + '

Identifiant du compte : ' . $userId .' (' . $userFirstname . ' ' . $userLastname . ')
' . + 'Email : ' . $userMail . '

' . + 'Validation de l\'inscription' + ); + } + + // Mail de confirmation à l'utilisateur + // forger le lien de vérification + $validateLink = helper::baseUrl(true) . $this->getUrl() . '/validate/' . $userId . '/' . $_SESSION['csrf']; + // Envoi + $sentMailtoUser = false; + if($check === true) { + $sentMailtoUser = $this->sendMail( + $userMail, + 'Confirmation de votre inscription', + '

' . $this->getdata(['module','registration',$this->getUrl(0),'config','mailRegisterContent']) . '

' . + 'Activer votre compte' + ); + } + } + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl(), + //'redirect' => $validateLink, + 'notification' => $sentMailtoUser ? "Consultez votre messagerie, un mail vous a été envoyé." : 'Quelque chose n\'a pas fonctionné !', + 'state' => $sentMailtoUser ? true : false + ]); + } + // Valeurs en sortie + $this->addOutput([ + 'title' => 'Inscription', + 'view' => 'index', + 'showBarEditButton' => true, + 'showPageContent' => true + ]); + } + + /** + * Vérification de l'email + */ + public function validate() { + // Vérifie la session + l'id + le timer + $check = true; + $notification = 'Bienvenue sur le site' . $this->getData(['config', 'title']) ; + $csrf = $this->getUrl(3); + $userId = $this->getUrl(2); + // Validité + if ( time() - $this->getData(['user',$userId,'timer']) <= (60 * $this->getdata(['module','registration',$this->getUrl(0),'config','pageTimeOut'])) ) { + $check = false; + $notification = 'Le lien n\'est plus valide'; + } + if (( $csrf !== $this->getData(['user',$userId,'auth']) ) ) { + $check = false; + $notification = 'Identifiant ou mot de passe inconnu'; + } + if ($check) { + $this->setData([ + 'user', + $userId, + [ + 'firstname' => $this->getData(['user',$userId,'firstname']), + 'lastname' => $this->getData(['user',$userId,'lastname']), + 'mail' => $this->getData(['user',$userId,'mail']), + 'password' => $this->getData(['user',$userId,'password']), + 'group' => $this->getdata(['module','registration',$this->getUrl(0),'config','state']) === true ? self::STATUS_VALIDATED : self::GROUP_MEMBER, + 'forgot' => 0, + 'timer' => $this->getData(['user',$userId,'timer']) + ] + ]); + } + // Valeurs en sortie + $this->addOutput([ + 'redirect' => $check ? helper::baseUrl() . $this->getdata(['module','registration',$this->getUrl(0),'config','pageSuccess']) : helper::baseUrl() . $this->getdata(['module','registration',$this->getUrl(0),'config','pageError']) , + 'notificaton' => $notification, + 'state' => $check + ]); + } + + /** + * Module de configuration + */ + public function config() { + // Soumission du formulaire + if($this->isPost()) { + // Lire les options et les enregistrer + $this->setData(['module','registration',$this->getUrl(0),'config', [ + 'timeOut' => $this->getInput('registrationConfigTimeOut',helper::FILTER_INT), + 'pageSuccess' => $this->getInput('registrationConfigSuccess'), + 'pageError' => $this->getInput('registrationConfigError'), + 'state' => $this->getInput('registrationConfigState',helper::FILTER_BOOLEAN), + 'mailRegisterContent' => $this->getInput('registrationconfigMailRegisterContent', null, true), + 'mailValidateContent' => $this->getInput('registrationconfigMailValidateContent', null, true), + ]]); + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(), + 'notification' => 'Modifications enregistrées', + 'state' => true + ]); + } + // Valeurs en sortie + $this->addOutput([ + 'title' => 'Configuration', + 'view' => 'config', + 'vendor' => ['tinymce'] + ]); + } +} + diff --git a/module/registration/view/config/config.css b/module/registration/view/config/config.css new file mode 100644 index 00000000..9774521b --- /dev/null +++ b/module/registration/view/config/config.css @@ -0,0 +1,15 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + +@import url("core/layout/admin.css"); \ No newline at end of file diff --git a/module/registration/view/config/config.php b/module/registration/view/config/config.php new file mode 100644 index 00000000..bdea4aed --- /dev/null +++ b/module/registration/view/config/config.php @@ -0,0 +1,90 @@ + + +
+
+ 'buttonGrey', + 'href' => helper::baseUrl() .'page/edit/' . $this->getUrl(0) , + 'ico' => 'left', + 'value' => 'Retour' + ]); ?> +
+
+ helper::baseUrl() .$this->getUrl(0) . '/user' , + 'value' => 'Inscriptions' + ]); ?> +
+
+ +
+
+
+
+
+

Paramètres

+
+
+ 'Validité du lien', + 'selected' => $this->getData(['module','registration',$this->getUrl(0),'config','timeOut']) + ]); ?> +
+
+
+
+ getData(['page']), 'title', 'SORT_ASC'), [ + 'label' => 'Redirection après confirmation', + 'selected' => $this->getData(['module','registration',$this->getUrl(0),'config','pageSuccess']) + ]); ?> +
+
+ getData(['page']), 'title', 'SORT_ASC'), [ + 'label' => 'Redirection après erreur', + 'selected' => $this->getData(['module','registration',$this->getUrl(0),'config','pageError']) + ]); ?> +
+
+
+
+ Confirmez votre inscription en cliquant sur ce lien dans les ... minutes.

'; ?> + 'Corps du mail de confirmation', + 'value' => !empty($this->getData(['module','registration',$this->getUrl(0),'config','mailRegisterContent'])) ? $this->getData(['module','registration',$this->getUrl(0),'config','mailRegisterContent']) : $messageDefault, + 'class' => 'editorWysiwyg', + 'help' => 'Précisez la durée de validité. Le lien sera inséré après ces explications.' + ]); ?> +
+
+
+
+
+
+
+
+

Approbation préalable

+
+
+ $this->getData(['module','registration',$this->getUrl(0),'config','state']), + 'help' => 'Les comptes sont inactifs tant que les inscriptions ne sont pas approuvées par un administrateur.', + 'check' => true + ]); ?> +
+
+
+
+ Votre inscription a été approuvée par un administrateur.

'; ?> + 'Corps du mail d\'approbation', + 'value' =>!empty($this->getData(['module','registration',$this->getUrl(0),'config','mailValidateContent'])) ? $this->getData(['module','registration',$this->getUrl(0),'config','mailValidateContent']) : $messageDefault, + 'class' => 'editorWysiwyg' + ]); ?> +
+
+
+
+
+ +
Version n° +
diff --git a/module/registration/view/edit/edit.css b/module/registration/view/edit/edit.css new file mode 100644 index 00000000..3b94602b --- /dev/null +++ b/module/registration/view/edit/edit.css @@ -0,0 +1,16 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + + +@import url("core/layout/admin.css"); \ No newline at end of file diff --git a/module/registration/view/edit/edit.js.php b/module/registration/view/edit/edit.js.php new file mode 100644 index 00000000..ecb23d44 --- /dev/null +++ b/module/registration/view/edit/edit.js.php @@ -0,0 +1,19 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + +/** + * Droits des groupes + */ +$("#registrationUserEditGroup").on("change", function() { + $(".registrationUserEditGroupDescription").hide(); + $("#registrationUserEditGroupDescription" + $(this).val()).show(); +}).trigger("change"); diff --git a/module/registration/view/edit/edit.php b/module/registration/view/edit/edit.php new file mode 100644 index 00000000..08497aae --- /dev/null +++ b/module/registration/view/edit/edit.php @@ -0,0 +1,109 @@ + +
+
+ getUrl(3)): ?> + 'buttonGrey', + 'href' => helper::baseUrl() . $this->geturl(0) . '/user', + 'ico' => 'left', + 'value' => 'Retour' + ]); ?> + + 'buttonGrey', + 'href' => helper::baseUrl(false), + 'ico' => 'home', + 'value' => 'Accueil' + ]); ?> + +
+
+ +
+
+
+
+
+

Confirmation de l'inscription

+
+
+
+
+ 'off', + 'label' => 'Prénom', + 'value' => $this->getData(['user', $this->getUrl(2), 'firstname']), + 'disabled'=> true + ]); ?> +
+
+ 'off', + 'label' => 'Nom', + 'value' => $this->getData(['user', $this->getUrl(2), 'lastname']), + 'disabled'=> true + ]); ?> +
+
+
+
+ 'off', + 'label' => 'Adresse mail', + 'value' => $this->getData(['user', $this->getUrl(2), 'mail']), + 'disabled'=> true + ]); ?> +
+
+
+
+ getData(['user', $this->getUrl(2), 'group'])];?> + 'État de l\'inscription', + 'value' => $status, + 'disabled'=> true, + 'help' => 'En attente : le mail n\'a pas encore été validé
Email validé : approbation nécessaire.' + ]); ?> +
+
+ 'Date', + 'value' => utf8_encode( date('Y-m-d G:i', $this->getData(['user',$this->getUrl(2), 'timer']))), + 'disabled'=> true + ]); ?> +
+
+
+ +
+ getUser('group') === self::GROUP_ADMIN): ?> + ($this->getUrl(2) === $this->getUser('id')), + 'help' => ($this->getUrl(2) === $this->getUser('id') ? 'Impossible de modifier votre propre groupe.' : ''), + 'label' => 'Groupe (Banni : en attente d\'approbation)', + 'selected' => $groups[$this->getData(['user', $this->getUrl(2), 'group'])] + ]); ?> + Autorisations : +
    +
  • Accès aux pages privées membres
  • +
+
    +
  • Accès aux pages privées membres et éditeurs
  • +
  • Ajout / Édition / Suppression de pages
  • +
  • Ajout / Édition / Suppression de fichiers
  • +
+
    +
  • Accès à toutes les pages privées
  • +
  • Ajout / Édition / Suppression de pages
  • +
  • Ajout / Édition / Suppression de fichiers
  • +
  • Ajout / Édition / Suppression d'utilisateurs
  • +
  • Configuration du site
  • +
  • Personnalisation du thème
  • +
+ +
+
+
+
+
+ \ No newline at end of file diff --git a/module/registration/view/index/index.js.php b/module/registration/view/index/index.js.php new file mode 100644 index 00000000..beb66a9f --- /dev/null +++ b/module/registration/view/index/index.js.php @@ -0,0 +1,48 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + + +/** + * Affichage de l'id en simulant FILTER_ID + */ +$("#registrationAddId").on("change keydown keyup", function(event) { + var userId = $(this).val(); + if( + event.keyCode !== 8 // BACKSPACE + && event.keyCode !== 37 // LEFT + && event.keyCode !== 39 // RIGHT + && event.keyCode !== 46 // DELETE + && window.getSelection().toString() !== userId // Texte sélectionné + ) { + var searchReplace = { + "á": "a", "à": "a", "â": "a", "ä": "a", "ã": "a", "å": "a", "ç": "c", "é": "e", "è": "e", "ê": "e", "ë": "e", "í": "i", "ì": "i", "î": "i", "ï": "i", "ñ": "n", "ó": "o", "ò": "o", "ô": "o", "ö": "o", "õ": "o", "ú": "u", "ù": "u", "û": "u", "ü": "u", "ý": "y", "ÿ": "y", + "Á": "A", "À": "A", "Â": "A", "Ä": "A", "Ã": "A", "Å": "A", "Ç": "C", "É": "E", "È": "E", "Ê": "E", "Ë": "E", "Í": "I", "Ì": "I", "Î": "I", "Ï": "I", "Ñ": "N", "Ó": "O", "Ò": "O", "Ô": "O", "Ö": "O", "Õ": "O", "Ú": "U", "Ù": "U", "Û": "U", "Ü": "U", "Ý": "Y", "Ÿ": "Y", + "'": "-", "\"": "-", " ": "-" + }; + userId = userId.replace(/[áàâäãåçéèêëíìîïñóòôöõúùûüýÿ'" ]/ig, function(match) { + return searchReplace[match]; + }); + userId = userId.replace(/[^a-z0-9-]/ig, ""); + $(this).val(userId); + } +}); + +/** + * Droits des groupes + */ +$("#registrationAddGroup").on("change", function() { + $(".registrationAddGroupDescription").hide(); + $("#registrationAddGroupDescription" + $(this).val()).show(); + console.log ($(this).val()); +}).trigger("change"); + + diff --git a/module/registration/view/index/index.php b/module/registration/view/index/index.php new file mode 100644 index 00000000..9ba78d50 --- /dev/null +++ b/module/registration/view/index/index.php @@ -0,0 +1,81 @@ + +
+
+
+

Identité

+
+
+ 'off', + 'label' => 'Prénom' + ]); ?> +
+
+ 'off', + 'label' => 'Nom' + ]); ?> +
+
+
+
+ 'off', + 'label' => 'Adresse mail' + ]); ?> +
+
+
+
+
+ self::GROUP_MEMBER + ]); ?> +
+
+ +
+

Données de connexion

+
+
+ 'off', + 'label' => 'Identifiant de connexion' + ]); ?> +
+
+
+
+ 'off', + 'label' => 'Mot de passe' + ]); ?> +
+
+
+
+ 'off', + 'label' => 'Confirmation du mot de passe' + ]); + ?> +
+
+
+
+
+ time() + ]); + ?> +
+
+
+
+
+ 'Envoyer' + ]); ?> +
+
+ diff --git a/module/registration/view/user/user.css b/module/registration/view/user/user.css new file mode 100644 index 00000000..3b94602b --- /dev/null +++ b/module/registration/view/user/user.css @@ -0,0 +1,16 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + + +@import url("core/layout/admin.css"); \ No newline at end of file diff --git a/module/registration/view/user/user.js.php b/module/registration/view/user/user.js.php new file mode 100644 index 00000000..f04544da --- /dev/null +++ b/module/registration/view/user/user.js.php @@ -0,0 +1,21 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + +/** + * Confirmation de suppression + */ +$(".registrationUserDelete").on("click", function() { + var _this = $(this); + return core.confirm("Êtes-vous sûr de vouloir supprimer cet utilisateur ?", function() { + $(location).attr("href", _this.attr("href")); + }); +}); \ No newline at end of file diff --git a/module/registration/view/user/user.php b/module/registration/view/user/user.php new file mode 100644 index 00000000..b01406bb --- /dev/null +++ b/module/registration/view/user/user.php @@ -0,0 +1,15 @@ +
+
+ 'buttonGrey', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', + 'value' => 'Retour' + ]); ?> +
+
+ + + + + + \ No newline at end of file diff --git a/module/registration/view/validate/validate.php b/module/registration/view/validate/validate.php new file mode 100644 index 00000000..923a0a1e --- /dev/null +++ b/module/registration/view/validate/validate.php @@ -0,0 +1,2 @@ + + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + + +class sondage extends common { + + const VERSION = '1.0'; + const REALNAME = 'Sondage'; + const DELETE = true; + const UPDATE = '0.0'; + const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json) + + public static $actions = [ + 'config' => self::GROUP_MODERATOR, + 'data' => self::GROUP_MODERATOR, + 'result' => self::GROUP_VISITOR, + 'delete' => self::GROUP_MODERATOR, + 'deleteall' => self::GROUP_MODERATOR, + 'index' => self::GROUP_VISITOR, + 'export2csv' => self::GROUP_MODERATOR, + 'output2csv' => self::GROUP_MODERATOR + ]; + + public static $data = []; + + public static $pages = []; + + public static $pagination; + + const TYPE_MAIL = 'mail'; + const TYPE_SELECT = 'select'; + const TYPE_TEXT = 'text'; + const TYPE_TEXTAREA = 'textarea'; + const TYPE_DATETIME = "date"; + const TYPE_CHECKBOX = "checkbox"; + + + public static $types = [ + self::TYPE_TEXT => 'Champ texte', + self::TYPE_TEXTAREA => 'Grand champ texte', + self::TYPE_MAIL => 'Champ mail', + self::TYPE_SELECT => 'Sélection', + self::TYPE_DATETIME => 'Date', + self::TYPE_CHECKBOX => 'Case à cocher' + ]; + + public static $listUsers = [ + ]; + + /** + * Configuration + */ + public function config() { + // Liste des utilisateurs + $userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname'); + ksort($userIdsFirstnames); + self::$listUsers [] = ''; + foreach($userIdsFirstnames as $userId => $userFirstname) { + self::$listUsers [] = $userId; + } + // Soumission du formulaire + if($this->isPost()) { + // Configuration + // Option sélectionnée sans page choisie + $this->setData([ + 'module', + $this->getUrl(0), + 'config', + [ + 'button' => $this->getInput('formConfigButton'), + 'capcha' => $this->getInput('formConfigCapcha', helper::FILTER_BOOLEAN), + 'group' => $this->getInput('formConfigGroup', helper::FILTER_INT), + 'user' => self::$listUsers [$this->getInput('formConfigUser', helper::FILTER_INT)], + 'mail' => $this->getInput('formConfigMail') , + 'pageId' => $this->getInput('formConfigPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formConfigPageId', helper::FILTER_ID) : '', + 'subject' => $this->getInput('formConfigSubject') + ] + ]); + // Génération des données vides + $this->setData(['module', $this->getUrl(0), 'data', []]); + // Génération des champs + $inputs = []; + foreach($this->getInput('formConfigPosition', null) as $index => $position) { + $inputs[] = [ + 'name' => $this->getInput('formConfigName[' . $index . ']'), + 'position' => helper::filter($position, helper::FILTER_INT), + 'required' => $this->getInput('formConfigRequired[' . $index . ']', helper::FILTER_BOOLEAN), + 'type' => $this->getInput('formConfigType[' . $index . ']'), + 'values' => $this->getInput('formConfigValues[' . $index . ']') + ]; + } + $this->setData(['module', $this->getUrl(0), 'input', $inputs]); + // Valeurs en sortie + $this->addOutput([ + 'notification' => 'Modifications enregistrées', + 'redirect' => helper::baseUrl() . $this->getUrl(), + 'state' => true + ]); + } + // Liste des pages + foreach($this->getHierarchy(null, false) as $parentPageId => $childrenPageIds) { + self::$pages[$parentPageId] = $this->getData(['page', $parentPageId, 'title']); + foreach($childrenPageIds as $childKey) { + self::$pages[$childKey] = '    ' . $this->getData(['page', $childKey, 'title']); + } + } + // Valeurs en sortie + $this->addOutput([ + 'title' => 'Configuration du module', + 'vendor' => [ + 'html-sortable', + 'flatpickr' + ], + 'view' => 'config' + ]); + } + + /** + * Données enregistrées + */ + public function data() { + $data = $this->getData(['module', $this->getUrl(0), 'data']); + if($data) { + // Pagination + $pagination = helper::pagination($data, $this->getUrl(),$this->getData(['config','itemsperPage'])); + // Liste des pages + self::$pagination = $pagination['pages']; + // Inverse l'ordre du tableau + $dataIds = array_reverse(array_keys($data)); + $data = array_reverse($data); + // Données en fonction de la pagination + for($i = $pagination['first']; $i < $pagination['last']; $i++) { + $content = ''; + foreach($data[$i] as $input => $value) { + $content .= $input . ' : ' . $value . '
'; + } + self::$data[] = [ + $content, + template::button('formDataDelete' . $dataIds[$i], [ + 'class' => 'formDataDelete buttonRed', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $dataIds[$i] . '/' . $_SESSION['csrf'], + 'value' => template::ico('cancel') + ]) + ]; + } + } + // Valeurs en sortie + $this->addOutput([ + 'title' => 'Données enregistrées', + 'view' => 'data' + ]); + } + + /** + * Réponses enregistrées + */ + public function result() { + $data = $this->getData(['module', $this->getUrl(0), 'data']); + if($data) { + // Pagination + $pagination = helper::pagination($data, $this->getUrl(),$this->getData(['config','itemsperPage'])); + // Liste des pages + self::$pagination = $pagination['pages']; + // Inverse l'ordre du tableau + $dataIds = array_reverse(array_keys($data)); + $data = array_reverse($data); + // Données en fonction de la pagination + for($i = $pagination['first']; $i < $pagination['last']; $i++) { + $content = ''; + foreach($data[$i] as $input => $value) { + $content .= $input . ' : ' . $value . '
'; + } + self::$data[] = [ + $content + ]; + } + } + // Valeurs en sortie + $this->addOutput([ + 'title' => 'Réponses', + 'view' => 'result' + ]); + } + + /** + * Export CSV + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + */ + public function export2csv() { + // Jeton incorrect + if ($this->getUrl(2) !== $_SESSION['csrf']) { + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', + 'notification' => 'Action non autorisée' + ]); + } else { + $data = $this->getData(['module', $this->getUrl(0), 'data']); + if ($data !== []) { + $csvfilename = 'data-'.date('dmY').'-'.date('hm').'-'.rand(10,99).'.csv'; + if (!file_exists(self::FILE_DIR.'source/data')) { + mkdir(self::FILE_DIR.'source/data'); + } + $fp = fopen(self::FILE_DIR.'source/data/'.$csvfilename, 'w'); + fputcsv($fp, array_keys($data[1]), ';','"'); + foreach ($data as $fields) { + fputcsv($fp, $fields, ';','"'); + } + fclose($fp); + // Valeurs en sortie + $this->addOutput([ + 'notification' => 'Export CSV effectué dans le gestionnaire de fichiers
sous le nom '.$csvfilename, + 'redirect' => helper::baseUrl() . $this->getUrl(0) .'/data', + 'state' => true + ]); + } else { + $this->addOutput([ + 'notification' => 'Aucune donnée à exporter', + 'redirect' => helper::baseUrl() . $this->getUrl(0) .'/data' + ]); + } + } + } + + + /** + * Suppression + */ + public function deleteall() { + // Jeton incorrect + if ($this->getUrl(2) !== $_SESSION['csrf']) { + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', + 'notification' => 'Action non autorisée' + ]); + } else { + $data = ($this->getData(['module', $this->getUrl(0), 'data'])); + if (count($data) > 0 ) { + // Suppression multiple + for ($i = 1; $i <= count($data) ; $i++) { + echo $this->deleteData(['module', $this->getUrl(0), 'data', $i]); + } + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', + 'notification' => 'Données supprimées', + 'state' => true + ]); + } else { + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', + 'notification' => 'Aucune donnée à supprimer' + ]); + } + } + } + + + /** + * Suppression + */ + public function delete() { + // Jeton incorrect + if ($this->getUrl(3) !== $_SESSION['csrf']) { + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', + 'notification' => 'Action non autorisée' + ]); + } else { + // La donnée n'existe pas + if($this->getData(['module', $this->getUrl(0), 'data', $this->getUrl(2)]) === null) { + // Valeurs en sortie + $this->addOutput([ + 'access' => false + ]); + } + // Suppression + else { + $this->deleteData(['module', $this->getUrl(0), 'data', $this->getUrl(2)]); + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', + 'notification' => 'Donnée supprimée', + 'state' => true + ]); + } + } + } + + + + + /** + * Accueil + */ + public function index() { + // Soumission du formulaire + if($this->isPost()) { + // Check la capcha + if( + $this->getData(['module', $this->getUrl(0), 'config', 'capcha']) + AND $this->getInput('formCapcha', helper::FILTER_INT) !== $this->getInput('formCapchaFirstNumber', helper::FILTER_INT) + $this->getInput('formCapchaSecondNumber', helper::FILTER_INT)) + { + self::$inputNotices['formCapcha'] = 'Incorrect'; + + } + // Préparation le contenu du mail + $data = []; + $content = ''; + foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) { + // Filtre la valeur + switch($input['type']) { + case self::TYPE_MAIL: + $filter = helper::FILTER_MAIL; + break; + case self::TYPE_TEXTAREA: + $filter = helper::FILTER_STRING_LONG; + break; + case self::TYPE_DATETIME: + $filter = helper::FILTER_STRING_SHORT; // Mettre TYPE_DATETIME pour récupérer un TIMESTAMP + break; + CASE self::TYPE_CHECKBOX: + $filter = helper::FILTER_BOOLEAN; + break; + default: + $filter = helper::FILTER_STRING_SHORT; + } + $value = $this->getInput('formInput[' . $index . ']', $filter, $input['required']); + // Préparation des données pour la création dans la base + $data[$this->getData(['module', $this->getUrl(0), 'input', $index, 'name'])] = $value; + // Préparation des données pour le mail + $content .= '' . $this->getData(['module', $this->getUrl(0), 'input', $index, 'name']) . ' : ' . $value . '
'; + } + // Crée les données + $this->setData(['module', $this->getUrl(0), 'data', helper::increment(1, $this->getData(['module', $this->getUrl(0), 'data'])), $data]); + // Envoi du mail + // Rechercher l'adresse en fonction du mail + $sent = true; + $singleuser = $this->getData(['user', + $this->getData(['module', $this->getUrl(0), 'config', 'user']), + 'mail']); + $singlemail = $this->getData(['module', $this->getUrl(0), 'config', 'mail']); + $group = $this->getData(['module', $this->getUrl(0), 'config', 'group']); + // Verification si le mail peut être envoyé + if( + self::$inputNotices === [] && ( + $group > 0 || + $singleuser !== '' || + $singlemail !== '' ) + ) { + // Utilisateurs dans le groupe + $to = []; + if ($group > 0){ + foreach($this->getData(['user']) as $userId => $user) { + if($user['group'] >= $group) { + $to[] = $user['mail']; + } + } + } + // Utilisateur désigné + if (!empty($singleuser)) { + $to[] = $singleuser; + } + // Mail désigné + if (!empty($singlemail)) { + $to[] = $singlemail; + } + if($to) { + // Sujet du mail + $subject = $this->getData(['module', $this->getUrl(0), 'config', 'subject']); + if($subject === '') { + $subject = 'Nouveau message en provenance de votre site'; + } + // Envoi le mail + $sent = $this->sendMail( + $to, + $subject, + 'Nouveau message en provenance de la page "' . $this->getData(['page', $this->getUrl(0), 'title']) . '" :

' . + $content + ); + } + } + // Redirection + $redirect = $this->getData(['module', $this->getUrl(0), 'config', 'pageId']); + // Valeurs en sortie + $this->addOutput([ + 'notification' => ($sent === true ? 'Formulaire soumis' : $sent), + 'redirect' => $redirect ? helper::baseUrl() . $redirect : '', + 'state' => ($sent === true ? true : null) + ]); + } + // Valeurs en sortie + $this->addOutput([ + 'showBarEditButton' => true, + 'showPageContent' => true, + 'view' => 'index', + 'vendor' => [ + 'flatpickr' + ], + ]); + } +} \ No newline at end of file diff --git a/module/sondage/vendor/html-sortable/html-sortable.min.js b/module/sondage/vendor/html-sortable/html-sortable.min.js new file mode 100644 index 00000000..9a96985e --- /dev/null +++ b/module/sondage/vendor/html-sortable/html-sortable.min.js @@ -0,0 +1 @@ +!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.sortable=t()}(this,function(){"use strict";function e(e,t,n){var r=null;return 0===t?e:function(){var a=n||this,o=arguments;clearTimeout(r),r=setTimeout(function(){e.apply(a,o)},t)}}var t,n,r,a=[],o=[],i=function(e,t,n){return void 0===n?e&&e.h5s&&e.h5s.data&&e.h5s.data[t]:(e.h5s=e.h5s||{},e.h5s.data=e.h5s.data||{},e.h5s.data[t]=n,void 0)},s=function(e){e.h5s&&delete e.h5s.data};switch(!0){case"matches"in window.Element.prototype:r="matches";break;case"mozMatchesSelector"in window.Element.prototype:r="mozMatchesSelector";break;case"msMatchesSelector"in window.Element.prototype:r="msMatchesSelector";break;case"webkitMatchesSelector"in window.Element.prototype:r="webkitMatchesSelector"}var l=function(e,t){if(!t)return Array.prototype.slice.call(e);for(var n=[],a=0;an){var c=o-n,f=p(e).top;if(id&&r>f+o-c)return}void 0===t.oldDisplay&&(t.oldDisplay=t.style.display),t.style.display="none",i + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + +/** + * Ajout d'un champ + */ +function add(inputUid, input) { + // Nouveau champ + var newInput = $($("#formConfigCopy").html()); + // Ajout de l'ID unique aux champs + newInput.find("a, input, select").each(function() { + var _this = $(this); + _this.attr({ + id: _this.attr("id").replace("[]", "[" + inputUid + "]"), + name: _this.attr("name").replace("[]", "[" + inputUid + "]") + }); + }); + newInput.find("label").each(function() { + var _this = $(this); + _this.attr("for", _this.attr("for").replace("[]", "[" + inputUid + "]")); + }); + // Attribue les bonnes valeurs + if(input) { + // Nom du champ + newInput.find("[name='formConfigName[" + inputUid + "]']").val(input.name); + // Type de champ + newInput.find("[name='formConfigType[" + inputUid + "]']").val(input.type); + // Largeur du champ + newInput.find("[name='formConfigWidth[" + inputUid + "]']").val(input.width); + // Valeurs du champ + newInput.find("[name='formConfigValues[" + inputUid + "]']").val(input.values); + // Champ obligatoire + newInput.find("[name='formConfigRequired[" + inputUid + "]']").prop("checked", input.required); + } + // Ajout du nouveau champ au DOM + $("#formConfigInputs") + .append(newInput.hide()) + .find(".formConfigInput").last().show(); + // Cache le texte d'absence de champ + $("#formConfigNoInput:visible").hide(); + // Check le type + $(".formConfigType").trigger("change"); + // Actualise les positions + position(); +} + +/** + * Calcul des positions + */ +function position() { + $("#formConfigInputs").find(".formConfigPosition").each(function(i) { + $(this).val(i + 1); + }); +} + +/** + * Ajout des champs déjà existant + */ +var inputUid = 0; +var inputs = getData(['module', $this->getUrl(0), 'input'])); ?>; +if(inputs) { + var inputsPerPosition = getData(['module', $this->getUrl(0), 'input']), 'position', 'SORT_ASC')); ?>; + $.each(inputsPerPosition, function(id) { + add(inputUid, inputs[id]); + inputUid++; + }); +} + +/** + * Afficher/cacher les options supplémentaires + */ +$(document).on("click", ".formConfigMoreToggle", function() { + $(this).parents(".formConfigInput").find(".formConfigMore").slideToggle(); +}); + +/** + * Crée un nouveau champ à partir des champs cachés + */ +$("#formConfigAdd").on("click", function() { + add(inputUid); + inputUid++; +}); + +/** + * Actions sur les champs + */ +// Tri entre les champs +sortable("#formConfigInputs", { + forcePlaceholderSize: true, + containment: "#formConfigInputs", + handle: ".formConfigMove" +}); +$("#formConfigInputs") + // Actualise les positions + .on("sortupdate", function() { + position(); + }) + // Suppression du champ + .on("click", ".formConfigDelete", function() { + var inputDOM = $(this).parents(".formConfigInput"); + // Cache le champ + inputDOM.hide(); + // Supprime le champ + inputDOM.remove(); + // Affiche le texte d'absence de champ + if($("#formConfigInputs").find(".formConfigInput").length === 0) { + $("#formConfigNoInput").show(); + } + // Actualise les positions + position(); + }) + // Affiche/cache le champ "Valeurs" en fonction des champs cachés + .on("change", ".formConfigType", function() { + var _this = $(this); + if(_this.val() === "select") { + _this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideDown(); + } + else { + _this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideUp(); + } + }); +// Simule un changement de type au chargement de la page +$(".formConfigType").trigger("change"); + +/** + * Affiche/cache les options de la case à cocher du mail + */ +$("#formConfigMailOptionsToggle").on("change", function() { + if($(this).is(":checked")) { + $("#formConfigMailOptions").slideDown(); + } + else { + $("#formConfigMailOptions").slideUp(function() { + $("#formConfigGroup").val(""); + $("#formConfigSubject").val(""); + $("#formConfigMail").val(""); + $("#formConfigUser").val(""); + }); + } +}).trigger("change"); + +/** + * Affiche/cache les options de la case à cocher de la redirection + */ +$("#formConfigPageIdToggle").on("change", function() { + if($(this).is(":checked")) { + $("#formConfigPageIdWrapper").slideDown(); + } + else { + $("#formConfigPageIdWrapper").slideUp(function() { + $("#formConfigPageId").val(""); + }); + } +}).trigger("change"); \ No newline at end of file diff --git a/module/sondage/view/config/config.php b/module/sondage/view/config/config.php new file mode 100644 index 00000000..8ded90fa --- /dev/null +++ b/module/sondage/view/config/config.php @@ -0,0 +1,155 @@ +
+
+ 'formConfigPosition' + ]); ?> +
+
+ template::ico('sort'), + 'class' => 'formConfigMove' + ]); ?> +
+
+ 'Intitulé' + ]); ?> +
+
+ 'formConfigType' + ]); ?> +
+
+ template::ico('gear'), + 'class' => 'formConfigMoreToggle' + ]); ?> +
+
+ template::ico('minus'), + 'class' => 'formConfigDelete' + ]); ?> +
+
+
+ 'Liste des valeurs séparées par des virgules (valeur1,valeur2,...)', + 'class' => 'formConfigValues', + 'classWrapper' => 'displayNone formConfigValuesWrapper' + ]); ?> + +
+
+
+ +
+
+ 'buttonGrey', + 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), + 'ico' => 'left', + 'value' => 'Retour' + ]); ?> +
+
+ helper::baseUrl() . $this->getUrl(0) . '/data', + 'value' => 'Gérer les données' + ]); ?> +
+
+ +
+
+
+
+
+

Configuration

+ 'Laissez vide afin de conserver le texte par défaut.', + 'label' => 'Texte du bouton de soumission', + 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button']) + ]); ?> + (bool) $this->getData(['module', $this->getUrl(0), 'config', 'group']) || + !empty($this->getData(['module', $this->getUrl(0), 'config', 'user'])) || + !empty($this->getData(['module', $this->getUrl(0), 'config', 'mail'])), + 'help' => 'Sélectionnez au moins un groupe, un utilisateur ou saississez un email.' + ]); ?> +
+
+
+ 'Laissez vide afin de conserver le texte par défaut.', + 'label' => 'Sujet du mail', + 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'subject']) + ]); ?> +
+
+ + Destinataires : +
+
+ 'Les groupes hiérarchiques à partir du groupe :', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'group']), + 'help' => 'Editeurs = éditeurs + administrateurs
Membres = membres + éditeurs + administrateurs' + ]); ?> +
+
+
+
+ 'Un membre :', + 'selected' => array_search($this->getData(['module', $this->getUrl(0), 'config', 'user']),$module::$listUsers) + ]); ?> +
+
+
+
+ 'Une adresse email ou une liste de diffusion:', + 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'mail']) + ]); ?> +
+
+
+ (bool) $this->getData(['module', $this->getUrl(0), 'config', 'pageId']) + ]); ?> +
+ 'displayNone', + 'label' => 'Sélectionner une page du site :', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageId']) + ]); ?> +
+ $this->getData(['module', $this->getUrl(0), 'config', 'capcha']) + ]); ?> +
+
+

Liste des champs

+
+ +
+
+
+
+ template::ico('plus') + ]); ?> +
+
+
+
+
+ +
Module version n° + +
diff --git a/module/sondage/view/data/data.js.php b/module/sondage/view/data/data.js.php new file mode 100644 index 00000000..91d0e044 --- /dev/null +++ b/module/sondage/view/data/data.js.php @@ -0,0 +1,31 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + +/** + * Confirmation de suppression + */ +$(".formDataDelete").on("click", function() { + var _this = $(this); + return core.confirm("Êtes-vous sûr de vouloir supprimer cette donnée ?", function() { + $(location).attr("href", _this.attr("href")); + }); +}); + +/** + * Confirmation de suppression de toutes les donénes + */ +$(".formDataDeleteAll").on("click", function() { + var _this = $(this); + return core.confirm("Êtes-vous sûr de vouloir supprimer toutes les données ?", function() { + $(location).attr("href", _this.attr("href")); + }); +}); \ No newline at end of file diff --git a/module/sondage/view/data/data.php b/module/sondage/view/data/data.php new file mode 100644 index 00000000..ae925983 --- /dev/null +++ b/module/sondage/view/data/data.php @@ -0,0 +1,28 @@ +
+
+ 'buttonGrey', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', + 'ico' => 'left', + 'value' => 'Retour' + ]); ?> +
+
+ 'formDataDeleteAll buttonRed', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/deleteall' . '/' . $_SESSION['csrf'], + 'ico' => 'cancel', + 'value' => 'Tout effacer' + ]); ?> +
+
+ 'buttonBlue', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/export2csv' . '/' . $_SESSION['csrf'], + 'ico' => 'download', + 'value' => 'Export CSV' + ]); ?> +
+
+ + \ No newline at end of file diff --git a/module/sondage/view/index/index.js.php b/module/sondage/view/index/index.js.php new file mode 100644 index 00000000..699b1831 --- /dev/null +++ b/module/sondage/view/index/index.js.php @@ -0,0 +1,24 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Frédéric Tempez + * @copyright Copyright (C) 2008-2018, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + +/** + * Paramétrage du format de date + */ +$(function() { + $(".datepicker").flatpickr({ + altInput: true, + altFormat: "d/m/Y", + enableTime: false, + locale: "fr", + dateFormat: "d/m/Y" + }); +}); diff --git a/module/sondage/view/index/index.php b/module/sondage/view/index/index.php new file mode 100644 index 00000000..ec6bf966 --- /dev/null +++ b/module/sondage/view/index/index.php @@ -0,0 +1,66 @@ +getData(['module', $this->getUrl(0), 'input'])): ?> + + getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?> + + 'formInput_' . $index, + 'label' => $input['name'] + ]); ?> + + $key) { + $values[$value] = trim($value); + } + ?> + 'formInput_' . $index, + 'label' => $input['name'] + ]); ?> + + 'formInput_' . $index, + 'label' => $input['name'] + ]); ?> + + 'formInput_' . $index, + 'label' => $input['name'] + ]); ?> + + 'formInput_' . $index, + 'label' => $input['name'], + 'vendor' => 'flatpickr' + ]); ?> + + + + + getData(['module', $this->getUrl(0), 'config', 'capcha'])): ?> +
+
+ +
+
+ +
+
+ 'Réponses', + 'class' => 'buttonBlue', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/result' . '/' . $_SESSION['csrf'] + ]); ?> +
+
+ $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : 'Envoyer', + 'ico' => '' + ]); ?> +
+
+ + + + \ No newline at end of file diff --git a/module/sondage/view/result/result.php b/module/sondage/view/result/result.php new file mode 100644 index 00000000..864c812c --- /dev/null +++ b/module/sondage/view/result/result.php @@ -0,0 +1,12 @@ +
+
+ 'buttonGrey', + 'href' => helper::baseUrl() . $this->getUrl(0), + 'ico' => 'left', + 'value' => 'Retour' + ]); ?> +
+
+ + \ No newline at end of file diff --git a/module/version/version.php b/module/version/version.php new file mode 100644 index 00000000..d851a457 --- /dev/null +++ b/module/version/version.php @@ -0,0 +1,36 @@ + * + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + * @link http://zwiicms.com/ + */ + +class version extends common { + + const VERSION = '1.0'; + const REALNAME = 'Version'; + const DELETE = true; + const UPDATE = '0.0'; + const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json) + + public static $actions = [ + 'index'=> self::GROUP_VISITOR + + ]; + + /** + * Retourne le numéro de version + */ + + public function index() { + exit( common::ZWII_VERSION); + } + +} diff --git a/module/version/view/index/index.php b/module/version/view/index/index.php new file mode 100644 index 00000000..2263730f --- /dev/null +++ b/module/version/view/index/index.php @@ -0,0 +1 @@ +