Browse Source

Merge branch 'extensions' into 11000

branche_v10
Fred Tempez 1 year ago
parent
commit
ce0297251c
  1. 1
      module/blog/view/article/article.css
  2. 114
      module/blog/view/article/article.php
  3. 13
      module/download/download.php
  4. 14
      module/download/view/add/add.php
  5. 14
      module/download/view/edit/edit.php
  6. 22
      module/download/view/item/item.js.php
  7. 314
      module/download/view/item/item.php
  8. 388
      module/registration/registration.php
  9. 15
      module/registration/view/config/config.css
  10. 90
      module/registration/view/config/config.php
  11. 16
      module/registration/view/edit/edit.css
  12. 19
      module/registration/view/edit/edit.js.php
  13. 109
      module/registration/view/edit/edit.php
  14. 48
      module/registration/view/index/index.js.php
  15. 81
      module/registration/view/index/index.php
  16. 16
      module/registration/view/user/user.css
  17. 21
      module/registration/view/user/user.js.php
  18. 15
      module/registration/view/user/user.php
  19. 2
      module/registration/view/validate/validate.php
  20. 419
      module/sondage/sondage.php
  21. 1
      module/sondage/vendor/html-sortable/html-sortable.min.js
  22. 3
      module/sondage/vendor/html-sortable/inc.json
  23. 3
      module/sondage/view/config/config.css
  24. 163
      module/sondage/view/config/config.js.php
  25. 155
      module/sondage/view/config/config.php
  26. 31
      module/sondage/view/data/data.js.php
  27. 28
      module/sondage/view/data/data.php
  28. 24
      module/sondage/view/index/index.js.php
  29. 66
      module/sondage/view/index/index.php
  30. 12
      module/sondage/view/result/result.php
  31. 36
      module/version/version.php
  32. 1
      module/version/view/index/index.php

1
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 {

114
module/blog/view/article/article.php

@ -1,66 +1,68 @@
<div class="row">
<div class="col10">
<div class="blogDate">
<i class="far fa-calendar-alt"></i>
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->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;
?>
</div>
<div class="col12">
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) == false) {
echo '<img class="blogArticlePicture blogArticlePicture' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picturePosition']) .
' pict' . $pictureSize . '" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) .
'" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . '">';
} ?>
<?php echo $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?>
</div>
<div class="col2">
</div>
<div class="row verticalAlignMiddle">
<div class="col12 blogDate">
<!-- bloc signature et date -->
<?php echo $module::$articleSignature . ' - ';?>
<i class="far fa-calendar-alt"></i>
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->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;
?>
<!-- Bloc edition -->
<?php if (
$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']
)
$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']
)
): ?>
<?php echo template::button('blogEdit', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'],
'value' => 'Editer'
]); ?>
)
): ?>
<a href ="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'];?>">
<?php echo template::ico('pencil');?> Editer
</a>
<?php endif; ?>
<!-- Bloc RSS-->
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
<div id="rssFeed">
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
<img src='module/news/ressource/feed-icon-16.gif' />
<?php
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
?>
</a>
</div>
<?php endif; ?>
</div>
</div>
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) == false) {
echo '<img class="blogArticlePicture blogArticlePicture' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picturePosition']) .
' pict' . $pictureSize . '" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) .
'" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . '">';
} ?>
<?php echo $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?>
<p class="clearBoth signature"><?php echo $module::$articleSignature;?></p>
<!-- Bloc RSS-->
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
<div id="rssFeed">
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
<img src='module/news/ressource/feed-icon-16.gif' />
<?php
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
?>
</a>
</div>
<?php endif; ?>
<?php if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?>
<p>Cet article ne reçoit pas de commentaire.</p>
<?php else: ?>

13
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),

14
module/download/view/add/add.php

@ -57,6 +57,20 @@
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::text('downloadAddFileAuthor', [
'label' => 'Auteur',
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileAuthor'])
]); ?>
</div>
<div class="col6">
<?php echo template::select('downloadAddFileLicense', $module::$itemLicense, [
'label' => 'Licence',
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileLicense'])
]); ?>
</div>
</div>
</div>
</div>
</div>

14
module/download/view/edit/edit.php

@ -64,6 +64,20 @@
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::text('downloadEditFileAuthor', [
'label' => 'Auteur',
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileAuthor'])
]); ?>
</div>
<div class="col6">
<?php echo template::select('downloadEditFileLicense', $module::$itemLicense, [
'label' => 'Licence',
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileLicense'])
]); ?>
</div>
</div>
</div>
</div>
</div>

22
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");
});

314
module/download/view/item/item.php

@ -1,27 +1,32 @@
<article>
<div class="row">
<div class="col10">
<div class="downloadDate">
<div class="row">
<div class="col9">
<div class="row">
<div class="col12">
<?php echo $this->getData(['module', $this->getUrl(0),'items', $this->getUrl(1), 'content']); ?>
</div>
</div>
<div class="row verticalAlignMiddle">
<div class="col12 downloadDate">
<?php echo $module::$itemSignature . ' - ';?>
<i class="far fa-calendar-alt"></i>
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->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;
?>
</div>
</div>
<div class="col2">
<?php if (
<!-- Bouton d'édition -->
<?php if (
$this->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 @@
)
)
): ?>
<?php echo template::button('downloadItemEdit', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'],
'value' => 'Editer'
]); ?>
<?php endif; ?>
<a href ="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'];?>">
<?php echo template::ico('pencil');?> Editer
</a>
<?php endif; ?>
<!-- Bloc RSS-->
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
<div id="rssFeed">
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
<img src='module/news/ressource/feed-icon-16.gif' />
<?php
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
?>
</a>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="row">
<div class="col3">
<div class="row">
<div class="col12">
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']); ?>
<?php
echo '<img class="downloaditemPicture" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) .
'" alt="' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) . '">';
?>
</div>
<div class="col3">
<div class="row">
<div class="col12">
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']); ?>
<?php
echo '<img class="downloadItemPicture" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) .
'" alt="' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) . '">';
?>
</div>
<div class="row">
<div class="col12">
<?php echo template::button('downloadItemFile', [
//'href' => 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'
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::button('downloadItemFile', [
//'href' => 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'
]); ?>
</div>
<div class="row">
<div class="col12 textAlignCenter">
<?php echo 'Version n°' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileVersion']); ?>
</div>
</div>
<div class="row">
<div class="col12 textAlignCenter">
<?php echo 'Version n°' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileVersion']); ?>
</div>
<div class="row">
<div class="col12 textAlignCenter">
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->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'])));
?>
<?php echo ' du ' . $date; ?>
</div>
</div>
<div class="row">
<div class="col12 textAlignCenter">
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->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'])));
?>
<?php echo ' du ' . $date; ?>
</div>
<div class="row">
<div class="col12 textAlignCenter">
<span>Téléchargements :
<?php echo $module::$statSum; ?>
</span>
</div>
</div>
<div class="row">
<div class="col12 textAlignCenter">
<span>Auteur :
<?php echo $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileAuthor']); ?>
</span>
</div>
</div>
<div class="col9">
<?php echo $this->getData(['module', $this->getUrl(0),'items', $this->getUrl(1), 'content']); ?>
<div class="row">
<div class="col12 textAlignCenter">
<span>Licence :
<?php echo $module::$itemLicense[$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileLicense'])]; ?>
</span>
</div>
</div>
<div class="col12">
<p class="clearBoth signature"><?php echo $module::$itemSignature;?></p>
<div class="row">
<div class="col12 textAlignCenter">
<span>Téléchargements :
<?php echo $module::$statSum; ?>
</span>
</div>
</div>
</div>
<!-- Bloc RSS-->
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
<div id="rssFeed">
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
<img src='module/news/ressource/feed-icon-16.gif' />
<?php
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
?>
</a>
</div>
<?php endif; ?>
<?php if($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentClose'])): ?>
<p>Cet item ne reçoit pas de commentaire.</p>
<?php else: ?>
<h3 id="comment">
<?php //$commentsNb = count($module::$comments); ?>
<?php $commentsNb = $module::$nbCommentsApproved; ?>
<?php $s = $commentsNb === 1 ? '': 's' ?>
<?php echo $commentsNb > 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?>
</h3>
<?php echo template::formOpen('downloaditemForm'); ?>
<?php echo template::text('downloaditemCommentShow', [
'placeholder' => 'Rédiger un commentaire...',
'readonly' => true
]); ?>
<div id="downloaditemCommentWrapper" class="displayNone">
<?php if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
<?php echo template::text('downloaditemUserName', [
'label' => 'Nom',
'readonly' => true,
'value' => $module::$editCommentSignature
]); ?>
<?php echo template::hidden('downloaditemUserId', [
'value' => $this->getUser('id')
]); ?>
<?php else: ?>
<div class="row">
<div class="col9">
<?php echo template::text('downloaditemAuthor', [
'label' => 'Nom'
]); ?>
</div>
<!-- Bloc commentaire -->
<div class="row">
<div class="col9">
<?php if($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentClose'])): ?>
<p>Cet item ne reçoit pas de commentaire.</p>
<?php else: ?>
<h3 id="comment">
<?php //$commentsNb = count($module::$comments); ?>
<?php $commentsNb = $module::$nbCommentsApproved; ?>
<?php $s = $commentsNb === 1 ? '': 's' ?>
<?php echo $commentsNb > 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?>
</h3>
<?php echo template::formOpen('downloadItemForm'); ?>
<?php echo template::text('downloadItemCommentShow', [
'placeholder' => 'Rédiger un commentaire...',
'readonly' => true
]); ?>
<div id="downloadItemCommentWrapper" class="displayNone">
<?php if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
<?php echo template::text('downloadItemUserName', [
'label' => 'Nom',
'readonly' => true,
'value' => $module::$editCommentSignature
]); ?>
<?php echo template::hidden('downloadItemUserId', [
'value' => $this->getUser('id')
]); ?>
<?php else: ?>
<div class="row">
<div class="col9">
<?php echo template::text('downloadItemAuthor', [
'label' => 'Nom'
]); ?>
</div>
<div class="col1 textAlignCenter verticalAlignBottom">
<div id="downloadItemOr">Ou</div>
</div>
<div class="col2 verticalAlignBottom">
<?php echo template::button('downloadItemLogin', [
'href' => helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment',
'value' => 'Connexion'
]); ?>
</div>
</div>
<div class="col1 textAlignCenter verticalAlignBottom">
<div id="downloaditemOr">Ou</div>
<?php endif; ?>
<?php echo template::textarea('downloadItemContent', [
'label' => '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'])
]); ?>
<div id="downloadItemContentAlarm"> </div>
<?php if($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
<div class="row">
<div class="col12">
<?php echo template::captcha('downloadItemCaptcha', [
'limit' => $this->getData(['config','captchaStrong'])
]); ?>
</div>
</div>
<div class="col2 verticalAlignBottom">
<?php echo template::button('downloaditemLogin', [
'href' => helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment',
'value' => 'Connexion'
<?php endif; ?>
<div class="row">
<div class="col2 offset8">
<?php echo template::button('downloadItemCommentHide', [
'class' => 'buttonGrey',
'value' => 'Annuler'
]); ?>
</div>
</div>
<?php endif; ?>
<?php echo template::textarea('downloaditemContent', [
'label' => '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'])
]); ?>
<div id="downloaditemContentAlarm"> </div>
<?php if($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
<div class="row">
<div class="col12">
<?php echo template::captcha('downloaditemCaptcha', [
'limit' => $this->getData(['config','captchaStrong'])
<div class="col2">
<?php echo template::submit('downloadItemSubmit', [
'value' => 'Envoyer',
'ico' => ''
]); ?>
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="col2 offset8">
<?php echo template::button('downloaditemCommentHide', [
'class' => 'buttonGrey',
'value' => 'Annuler'
]); ?>
</div>
<div class="col2">
<?php echo template::submit('downloaditemSubmit', [
'value' => 'Envoyer',
'ico' => ''
]); ?>
</div>
</div>
<?php endif;?>
<div class="row">
<div class="col12">
<?php foreach($module::$comments as $commentId => $comment): ?>
<div class="block">
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
le <?php echo mb_detect_encoding(strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
? strftime('%d %B %Y - %H:%M', $comment['createdOn'])
: utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn']));
?>
<?php echo $comment['content']; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif;?>
<div class="row">
<div class="col12">
<?php foreach($module::$comments as $commentId => $comment): ?>
<div class="block">
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
le <?php echo mb_detect_encoding(strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
? strftime('%d %B %Y - %H:%M', $comment['createdOn'])
: utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn']));
?>
<?php echo $comment['content']; ?>
</div>
<?php endforeach; ?>
</div>
</div>
<?php echo $module::$pages; ?>
</article>
</div>
<?php echo $module::$pages; ?>

388
module/registration/registration.php

@ -0,0 +1,388 @@
<?php
/**
* 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 <frederic.tempez@outlook.com>
* @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',
'<p>' . $this->getdata(['module','registration',$this->getUrl(0),'config','mailValidateContent']) . '</p>'
);
}
// 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']),
'<p>' . $messageAdmin . '</p>' .
'<p><strong>Identifiant du compte :</strong> ' . $userId .' (' . $userFirstname . ' ' . $userLastname . ')<br>' .
'<strong>Email :</strong> ' . $userMail . '</p>' .
'<a href="' . helper::baseUrl() . 'user/login/' . strip_tags(str_replace('/', '_', $this->getUrl(0) . '/user')) . '">Validation de l\'inscription</a>'
);
}
// 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',
'<p>' . $this->getdata(['module','registration',$this->getUrl(0),'config','mailRegisterContent']) . '</p>' .
'<a href="'. $validateLink . '">Activer votre compte<a/>'
);
}
}
// 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']
]);
}
}

15
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 <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-2020, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.com/
*/
@import url("core/layout/admin.css");

90
module/registration/view/config/config.php

@ -0,0 +1,90 @@
<?php echo template::formOpen('registrationConfig'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('registrationConfigBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() .'page/edit/' . $this->getUrl(0) ,
'ico' => 'left',
'value' => 'Retour'
]); ?>
</div>
<div class="col2 offset6">
<?php echo template::button('registrationConfigBack', [
'href' => helper::baseUrl() .$this->getUrl(0) . '/user' ,
'value' => 'Inscriptions'
]); ?>
</div>
<div class="col2">
<?php echo template::submit('registrationConfigSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Paramètres</h4>
<div class="row">
<div class="col6">
<?php echo template::select('registrationConfigTimeOut', $module::$timeLimit , [
'label' => 'Validité du lien',
'selected' => $this->getData(['module','registration',$this->getUrl(0),'config','timeOut'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::select('registrationConfigSuccess', helper::arrayCollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
'label' => 'Redirection après confirmation',
'selected' => $this->getData(['module','registration',$this->getUrl(0),'config','pageSuccess'])
]); ?>
</div>
<div class="col6">
<?php echo template::select('registrationConfigError', helper::arrayCollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
'label' => 'Redirection après erreur',
'selected' => $this->getData(['module','registration',$this->getUrl(0),'config','pageError'])
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php $messageDefault = '<p>Confirmez votre inscription en cliquant sur ce lien dans les ... minutes.</p>'; ?>
<?php echo template::textarea('registrationconfigMailRegisterContent', [
'label' => '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.'
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Approbation préalable</h4>
<div class="row">
<div class="col6 verticalAlignMiddle">
<?php echo template::checkbox('registrationConfigState', true, 'Activée', [
'checked' => $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
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php $messageDefault = '<p>Votre inscription a été approuvée par un administrateur.</p>'; ?>
<?php echo template::textarea('registrationconfigMailValidateContent', [
'label' => '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'
]); ?>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>
<div class="moduleVersion">Version n°<?php echo $module::VERSION; ?>
</div>

16
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 <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-2020, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.com/
*/
@import url("core/layout/admin.css");

19
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 <frederic.tempez@outlook.com>
* @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");

109
module/registration/view/edit/edit.php

@ -0,0 +1,109 @@
<?php echo template::formOpen('registrationUserEditForm'); ?>
<div class="row">
<div class="col2">
<?php if($this->getUrl(3)): ?>
<?php echo template::button('registrationUserEditBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->geturl(0) . '/user',
'ico' => 'left',
'value' => 'Retour'
]); ?>
<?php else: ?>
<?php echo template::button('registrationUserEditBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl(false),
'ico' => 'home',
'value' => 'Accueil'
]); ?>
<?php endif; ?>
</div>
<div class="col2 offset8">
<?php echo template::submit('registrationUserEditSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Confirmation de l'inscription</h4>
<div class="row">
<div class="col6">
<div class="row">
<div class="col6">
<?php echo template::text('registrationUserEditFirstname', [
'autocomplete' => 'off',
'label' => 'Prénom',
'value' => $this->getData(['user', $this->getUrl(2), 'firstname']),
'disabled'=> true
]); ?>
</div>
<div class="col6">
<?php echo template::text('registrationUserEditLastname', [
'autocomplete' => 'off',
'label' => 'Nom',
'value' => $this->getData(['user', $this->getUrl(2), 'lastname']),
'disabled'=> true
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::mail('registrationUserEditMail', [
'autocomplete' => 'off',
'label' => 'Adresse mail',
'value' => $this->getData(['user', $this->getUrl(2), 'mail']),
'disabled'=> true
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php $status = $module::$statusGroups[$this->getData(['user', $this->getUrl(2), 'group'])];?>
<?php echo template::text('resgistrationUserState', [
'label' => 'État de l\'inscription',
'value' => $status,
'disabled'=> true,
'help' => 'En attente : le mail n\'a pas encore été validé<br>Email validé : approbation nécessaire.'
]); ?>
</div>
<div class="col6">
<?php echo template::text('resgistrationUsertimer', [
'label' => 'Date',
'value' => utf8_encode( date('Y-m-d G:i', $this->getData(['user',$this->getUrl(2), 'timer']))),
'disabled'=> true
]); ?>
</div>
</div>
</div>
<div class="col6">
<?php if($this->getUser('group') === self::GROUP_ADMIN): ?>
<?php echo template::select('registrationUserEditGroup', self::$groupEdits, [
'disabled' => ($this->getUrl(2) === $this->getUser('id')),
'help' => ($this->getUrl(2) === $this->getUser('id') ? 'Impossible de modifier votre propre groupe.' : ''),
'label' => 'Groupe <em>(Banni : en attente d\'approbation)</em>',
'selected' => $groups[$this->getData(['user', $this->getUrl(2), 'group'])]
]); ?>
Autorisations :
<ul id="registrationUserEditGroupDescription<?php echo self::GROUP_MEMBER; ?>" class="registrationUserEditGroupDescription displayNone">
<li>Accès aux pages privées membres</li>
</ul>
<ul id="registrationUserEditGroupDescription<?php echo self::GROUP_MODERATOR; ?>" class="registrationUserEditGroupDescription displayNone">
<li>Accès aux pages privées membres et éditeurs</li>
<li>Ajout / Édition / Suppression de pages</li>
<li>Ajout / Édition / Suppression de fichiers</li>
</ul>
<ul id="registrationUserEditGroupDescription<?php echo self::GROUP_ADMIN; ?>" class="registrationUserEditGroupDescription displayNone">
<li>Accès à toutes les pages privées</li>
<li>Ajout / Édition / Suppression de pages</li>
<li>Ajout / Édition / Suppression de fichiers</li>
<li>Ajout / Édition / Suppression d'utilisateurs</li>
<li>Configuration du site</li>
<li>Personnalisation du thème</li>
</ul>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>

48
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 <frederic.tempez@outlook.com>
* @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");

81
module/registration/view/index/index.php

@ -0,0 +1,81 @@
<?php echo template::formOpen('registrationAddForm'); ?>
<div class="row">
<div class="col8 offset2">
<div class='block'>
<h4>Identité</h4>
<div class="row">
<div class="col6">
<?php echo template::text('registrationAddFirstname', [
'autocomplete' => 'off',
'label' => 'Prénom'
]); ?>
</div>
<div class="col6">
<?php echo template::text('registrationAddLastname', [
'autocomplete' => 'off',
'label' => 'Nom'
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::mail('registrationAddMail', [
'autocomplete' => 'off',
'label' => 'Adresse mail'
]); ?>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::hidden('registrationAddGroup', [
'value' => self::GROUP_MEMBER
]); ?>
</div>
</div>
<div class='block'>
<h4>Données de connexion</h4>
<div class="row">
<div class="col12">
<?php echo template::text('registrationAddId', [
'autocomplete' => 'off',
'label' => 'Identifiant de connexion'
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::password('registrationAddPassword', [
'autocomplete' => 'off',
'label' => 'Mot de passe'
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::password('registrationAddConfirmPassword', [
'autocomplete' => 'off',
'label' => 'Confirmation du mot de passe'
]);
?>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::hidden('registrationAddTimer', [
'value' => time()
]);
?>
</div>
</div>
</div>