Compare commits
81 Commits
Author | SHA1 | Date | |
---|---|---|---|
20c09d8b0a | |||
4c88d7a71d | |||
bb9b8b086f | |||
61752a9a51 | |||
889e2754fc | |||
77b241c69f | |||
442b84a99d | |||
09f9f6bdd6 | |||
5eace20e26 | |||
18df3848f8 | |||
7b9d145533 | |||
75ad5853cf | |||
7862815f1f | |||
a87d439282 | |||
509c1d6365 | |||
e641ec1c03 | |||
3dec8a8ce5 | |||
54f0b0c6e3 | |||
931e59db2e | |||
cae0e6c8fb | |||
afee77b1e7 | |||
cf8963248e | |||
22af8ac751 | |||
2d4385f038 | |||
c4bb124bea | |||
a474a41402 | |||
e9f65a1e22 | |||
8183b0bb0b | |||
585c888007 | |||
d0997ccbf9 | |||
1a6bfab54b | |||
23f38a606f | |||
f1e1989c97 | |||
9bb5793720 | |||
64443322a0 | |||
76258c835f | |||
dc81614114 | |||
8dc1adc28a | |||
65eac4ac4a | |||
a8f70dc73a | |||
02aeb6ec22 | |||
5bdb38dfec | |||
5700200bc3 | |||
4ffca0e34a | |||
f4553110e1 | |||
bf3b1f9cb0 | |||
05d8ae9e0b | |||
6128d0778d | |||
c38bd7d12f | |||
cd509dfcb1 | |||
5ab8efe72e | |||
6cf6a8d6b2 | |||
daaf309b4d | |||
2d5c395aec | |||
5d5b1e3140 | |||
8aa24e50ab | |||
8574970bb0 | |||
89e6e12748 | |||
9234b76062 | |||
08c1619162 | |||
576f349b4a | |||
be6eaa748e | |||
1dc7b08d2e | |||
35521766cd | |||
c8ee063963 | |||
f0aba44ddb | |||
e6236e5de2 | |||
e5629de660 | |||
92d3da27a3 | |||
1fd0c5492f | |||
bab06033ed | |||
f7cf0f94fc | |||
c244651b62 | |||
beb58da3bd | |||
8756162428 | |||
511a6ff0bb | |||
4175ff828d | |||
087b5d9999 | |||
fea1c40a4b | |||
2dce24f9f2 | |||
0e0fd23913 |
@ -1,4 +1,4 @@
|
|||||||
# ZwiiCampus 1.11.00
|
# ZwiiCampus 1.14.00
|
||||||
|
|
||||||
ZwiiCampus (Learning Management System) est logiciel auteur destiné à mettre en ligne des tutoriels. Il dispose de plusieurs modalités d'ouverture et d'accès des contenus. Basé sur la version 13 du CMS Zwii, la structure logicielle est solide, le framework de Zwii est éprouvé.
|
ZwiiCampus (Learning Management System) est logiciel auteur destiné à mettre en ligne des tutoriels. Il dispose de plusieurs modalités d'ouverture et d'accès des contenus. Basé sur la version 13 du CMS Zwii, la structure logicielle est solide, le framework de Zwii est éprouvé.
|
||||||
|
|
||||||
|
@ -673,10 +673,30 @@ class helper
|
|||||||
public static function subword($text, $start, $length)
|
public static function subword($text, $start, $length)
|
||||||
{
|
{
|
||||||
$text = trim($text);
|
$text = trim($text);
|
||||||
if (strlen($text) > $length) {
|
|
||||||
|
// Vérifier si la longueur du texte sans les balises dépasse la longueur souhaitée
|
||||||
|
if (mb_strlen(strip_tags($text)) > $length) {
|
||||||
|
// Utiliser mb_substr pour couper le texte
|
||||||
$text = mb_substr($text, $start, $length);
|
$text = mb_substr($text, $start, $length);
|
||||||
$text = mb_substr($text, 0, min(mb_strlen($text), mb_strrpos($text, ' ')));
|
|
||||||
|
// S'assurer que le texte ne se termine pas au milieu d'un mot
|
||||||
|
$lastSpace = mb_strrpos($text, ' ');
|
||||||
|
if ($lastSpace !== false) {
|
||||||
|
$text = mb_substr($text, 0, $lastSpace);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fermer les balises HTML ouvertes
|
||||||
|
$dom = new DOMDocument();
|
||||||
|
@$dom->loadHTML('<div>' . $text . '</div>', LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
|
||||||
|
$text = $dom->saveHTML();
|
||||||
|
|
||||||
|
// Retirer la balise de conteneur ajoutée
|
||||||
|
$text = preg_replace('~^<div>(.*)</div>$~s', '$1', $text);
|
||||||
|
|
||||||
|
// Ajouter des points de suspension si le texte a été coupé
|
||||||
|
$text .= '...';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,21 +156,21 @@ class JsonDb extends \Prowebcraft\Dot
|
|||||||
// Essaye d'écrire les données encodées dans le fichier de base de données
|
// Essaye d'écrire les données encodées dans le fichier de base de données
|
||||||
$write_result = file_put_contents($this->db, $encoded_data, LOCK_EX); // Les utilisateurs multiples obtiennent un verrou
|
$write_result = file_put_contents($this->db, $encoded_data, LOCK_EX); // Les utilisateurs multiples obtiennent un verrou
|
||||||
|
|
||||||
|
// $now = \DateTime::createFromFormat('U.u', microtime(true));
|
||||||
|
// file_put_contents("tmplog.txt", '[JsonDb][' . $now->format('H:i:s.u') . ']--' . $this->db . "\r\n", FILE_APPEND);
|
||||||
|
|
||||||
// Vérifie si l'écriture a réussi
|
// Vérifie si l'écriture a réussi
|
||||||
if ($write_result === $encoded_length) {
|
if ($write_result === $encoded_length) {
|
||||||
// Sort de la boucle si l'écriture a réussi
|
// Sort de la boucle si l'écriture a réussi
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incrémente le compteur de tentatives
|
// Incrémente le compteur de tentatives
|
||||||
$attempt++;
|
$attempt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vérifie si l'écriture a échoué même après plusieurs tentatives
|
// Vérifie si l'écriture a échoué même après plusieurs tentatives
|
||||||
if ($write_result !== $encoded_length) {
|
if ($write_result !== $encoded_length) {
|
||||||
// Enregistre un message d'erreur dans le journal des erreurs
|
// Enregistre un message d'erreur dans le journal des erreurs
|
||||||
error_log('Erreur d\'écriture, les données n\'ont pas été sauvegardées.');
|
error_log('Erreur d\'écriture, les données n\'ont pas été sauvegardées.');
|
||||||
|
|
||||||
// Affiche un message d'erreur et termine le script
|
// Affiche un message d'erreur et termine le script
|
||||||
exit('Erreur d\'écriture, les données n\'ont pas été sauvegardées.');
|
exit('Erreur d\'écriture, les données n\'ont pas été sauvegardées.');
|
||||||
}
|
}
|
||||||
|
@ -82,17 +82,25 @@ class layout extends common
|
|||||||
$content = 'col' . $blocks[1];
|
$content = 'col' . $blocks[1];
|
||||||
$blockright = 'col' . $blocks[2];
|
$blockright = 'col' . $blocks[2];
|
||||||
}
|
}
|
||||||
// Page pleine pour la configuration des modules et l'édition des pages sauf l'affichage d'un article de blog
|
// Toujours en pleine page pour la configuration des modules et l'édition des pages sauf l'affichage d'un article de blog
|
||||||
$pattern = ['config', 'edit', 'add', 'comment', 'data'];
|
$pattern = ['config', 'edit', 'add', 'comment', 'data', 'option', 'theme', 'comment', 'article', 'data', 'gallery', 'update', 'users', 'validate'];
|
||||||
if (
|
if (
|
||||||
(sizeof($blocks) === 1 ||
|
(sizeof($blocks) === 1 ||
|
||||||
in_array($this->getUrl(1), $pattern))
|
in_array($this->getUrl(1), $pattern))
|
||||||
) { // Pleine page en mode configuration
|
) { // Pleine page en mode configuration
|
||||||
if ($this->getData(['page', $this->getUrl(0), 'navLeft']) === 'top' || $this->getData(['page', $this->getUrl(0), 'navRight']) === 'top') {
|
if (
|
||||||
|
($this->getData(['page', $this->getUrl(0), 'navLeft']) === 'top'
|
||||||
|
|| $this->getData(['page', $this->getUrl(0), 'navRight']) === 'top')
|
||||||
|
&& in_array($this->getUrl(1), $pattern) === false
|
||||||
|
) {
|
||||||
$this->showNavButtons('top');
|
$this->showNavButtons('top');
|
||||||
}
|
}
|
||||||
$this->showContent();
|
$this->showContent();
|
||||||
if ($this->getData(['page', $this->getUrl(0), 'navLeft']) === 'bottom' || $this->getData(['page', $this->getUrl(0), 'navRight']) === 'bottom') {
|
if (
|
||||||
|
($this->getData(['page', $this->getUrl(0), 'navLeft']) === 'bottom'
|
||||||
|
|| $this->getData(['page', $this->getUrl(0), 'navRight']) === 'bottom')
|
||||||
|
&& in_array($this->getUrl(1), $pattern) === false
|
||||||
|
) {
|
||||||
$this->showNavButtons('bottom');
|
$this->showNavButtons('bottom');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -330,7 +338,7 @@ class layout extends common
|
|||||||
// Affichage du lien de connexion
|
// Affichage du lien de connexion
|
||||||
if (
|
if (
|
||||||
($this->getData(['theme', 'footer', 'loginLink'])
|
($this->getData(['theme', 'footer', 'loginLink'])
|
||||||
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
and $this->isConnected() === false
|
||||||
)
|
)
|
||||||
or $this->getUrl(0) === 'theme'
|
or $this->getUrl(0) === 'theme'
|
||||||
) {
|
) {
|
||||||
@ -352,11 +360,11 @@ class layout extends common
|
|||||||
$items .= $this->getData(['theme', 'footer', 'displaymemberAccount']) === false ? ' class="displayNone">' : '>';
|
$items .= $this->getData(['theme', 'footer', 'displaymemberAccount']) === false ? ' class="displayNone">' : '>';
|
||||||
$items .= '<wbr> | ';
|
$items .= '<wbr> | ';
|
||||||
if (
|
if (
|
||||||
$this->getUser('permission', 'filemanager') === true
|
$this->getUser('permission', 'filemanager') === true
|
||||||
&& $this->getUser('permission', 'folder', (self::$siteContent === 'home' ? 'homePath' : 'coursePath')) !== 'none'
|
&& $this->getUser('permission', 'folder', (self::$siteContent === 'home' ? 'homePath' : 'coursePath')) !== 'none'
|
||||||
) {
|
) {
|
||||||
$items .= '<wbr>' . template::ico('folder', [
|
$items .= '<wbr>' . template::ico('folder', [
|
||||||
'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']) . '&fldr=/' . self::$siteContent,
|
'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']) . '&fldr=/' . self::$siteContent,
|
||||||
'margin' => 'all',
|
'margin' => 'all',
|
||||||
'attr' => 'data-lity',
|
'attr' => 'data-lity',
|
||||||
'help' => 'Fichiers du site'
|
'help' => 'Fichiers du site'
|
||||||
@ -520,8 +528,10 @@ class layout extends common
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
// Affiche l'icône RFM
|
// Affiche l'icône RFM
|
||||||
if ($this->getUser('permission', 'filemanager') === true
|
if (
|
||||||
&& $this->getUser('permission', 'folder', (self::$siteContent === 'home' ? 'homePath' : 'coursePath')) !== 'none') {
|
$this->getUser('permission', 'filemanager') === true
|
||||||
|
&& $this->getUser('permission', 'folder', (self::$siteContent === 'home' ? 'homePath' : 'coursePath')) !== 'none'
|
||||||
|
) {
|
||||||
$itemsRight .= '<li>' . template::ico('folder', [
|
$itemsRight .= '<li>' . template::ico('folder', [
|
||||||
'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']) . '&fldr=/' . self::$siteContent,
|
'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']) . '&fldr=/' . self::$siteContent,
|
||||||
'attr' => 'data-lity',
|
'attr' => 'data-lity',
|
||||||
@ -547,7 +557,7 @@ class layout extends common
|
|||||||
// Lien de connexion
|
// Lien de connexion
|
||||||
if (
|
if (
|
||||||
($this->getData(['theme', 'menu', 'loginLink'])
|
($this->getData(['theme', 'menu', 'loginLink'])
|
||||||
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
and $this->isConnected() === false
|
||||||
)
|
)
|
||||||
or $this->getUrl(0) === 'theme'
|
or $this->getUrl(0) === 'theme'
|
||||||
) {
|
) {
|
||||||
@ -592,9 +602,9 @@ class layout extends common
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
($this->getData(['page', $parentPageId, 'disable']) === true
|
($this->getData(['page', $parentPageId, 'disable']) === true
|
||||||
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
and $this->isConnected() === false
|
||||||
) or ($this->getData(['page', $parentPageId, 'disable']) === true
|
) or ($this->getData(['page', $parentPageId, 'disable']) === true
|
||||||
and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
and $this->isConnected() === true
|
||||||
and $this->getUser('group') < self::GROUP_EDITOR
|
and $this->getUser('group') < self::GROUP_EDITOR
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@ -658,9 +668,9 @@ class layout extends common
|
|||||||
$items .= '<li id=' . $childKey . '>';
|
$items .= '<li id=' . $childKey . '>';
|
||||||
if (
|
if (
|
||||||
($this->getData(['page', $childKey, 'disable']) === true
|
($this->getData(['page', $childKey, 'disable']) === true
|
||||||
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
and $this->isConnected() === false
|
||||||
) or ($this->getData(['page', $childKey, 'disable']) === true
|
) or ($this->getData(['page', $childKey, 'disable']) === true
|
||||||
and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
and $this->isConnected() === true
|
||||||
and $this->getUser('group') < self::GROUP_EDITOR
|
and $this->getUser('group') < self::GROUP_EDITOR
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@ -754,7 +764,7 @@ class layout extends common
|
|||||||
$items .= '<li class="menuSideChild">';
|
$items .= '<li class="menuSideChild">';
|
||||||
if (
|
if (
|
||||||
$this->getData(['page', $parentPageId, 'disable']) === true
|
$this->getData(['page', $parentPageId, 'disable']) === true
|
||||||
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
and $this->isConnected() === false
|
||||||
) {
|
) {
|
||||||
$items .= '<a href="' . $this->getUrl(1) . '">';
|
$items .= '<a href="' . $this->getUrl(1) . '">';
|
||||||
} else {
|
} else {
|
||||||
@ -778,7 +788,7 @@ class layout extends common
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
$this->getData(['page', $childKey, 'disable']) === true
|
$this->getData(['page', $childKey, 'disable']) === true
|
||||||
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
and $this->isConnected() === false
|
||||||
) {
|
) {
|
||||||
$itemsChildren .= '<a href="' . $this->getUrl(1) . '">';
|
$itemsChildren .= '<a href="' . $this->getUrl(1) . '">';
|
||||||
} else {
|
} else {
|
||||||
@ -914,7 +924,7 @@ class layout extends common
|
|||||||
*/
|
*/
|
||||||
public function showBar()
|
public function showBar()
|
||||||
{
|
{
|
||||||
if ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')) {
|
if ($this->isConnected() === true) {
|
||||||
// Items de gauche
|
// Items de gauche
|
||||||
$leftItems = '';
|
$leftItems = '';
|
||||||
// Sélecteur de contenu
|
// Sélecteur de contenu
|
||||||
@ -931,7 +941,7 @@ class layout extends common
|
|||||||
}
|
}
|
||||||
$leftItems .= '</select></li>';
|
$leftItems .= '</select></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$leftItems .= '<li>' . template::ico('cubes', [
|
$leftItems .= '<li>' . template::ico('cubes', [
|
||||||
'href' => helper::baseUrl() . 'course',
|
'href' => helper::baseUrl() . 'course',
|
||||||
'help' => 'Gérer les espaces'
|
'help' => 'Gérer les espaces'
|
||||||
@ -1016,53 +1026,53 @@ class layout extends common
|
|||||||
)
|
)
|
||||||
// Sur une page d'accueil
|
// Sur une page d'accueil
|
||||||
or $this->getUrl(0) === ''
|
or $this->getUrl(0) === ''
|
||||||
|
) {
|
||||||
|
// Bouton Editer une page
|
||||||
|
if (
|
||||||
|
$this->getUser('permission', 'page', 'edit')
|
||||||
|
and $this->geturl(1) !== 'edit'
|
||||||
) {
|
) {
|
||||||
// Bouton Editer une page
|
$leftItems .= '<li>' . template::ico('pencil', [
|
||||||
if (
|
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0) . '/' . self::$siteContent,
|
||||||
$this->getUser('permission', 'page', 'edit')
|
'help' => 'Éditer la page'
|
||||||
and $this->geturl(1) !== 'edit'
|
]) . '</li>';
|
||||||
) {
|
|
||||||
$leftItems .= '<li>' . template::ico('pencil', [
|
|
||||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0) . '/' . self::$siteContent,
|
|
||||||
'help' => 'Éditer la page'
|
|
||||||
]) . '</li>';
|
|
||||||
}
|
|
||||||
// Bouton Editer le module d'une page
|
|
||||||
if (
|
|
||||||
$this->getUser('permission', 'page', 'module')
|
|
||||||
and $this->geturl(1) !== 'edit'
|
|
||||||
and $this->getData(['page', $this->getUrl(0), 'moduleId'])
|
|
||||||
) {
|
|
||||||
$leftItems .= '<li>' . template::ico('gear', [
|
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
|
||||||
'help' => 'Module de la page'
|
|
||||||
]) . '</li>';
|
|
||||||
}
|
|
||||||
// Bouton dupliquer une page
|
|
||||||
if (
|
|
||||||
$this->getUser('permission', 'page', 'duplicate')
|
|
||||||
and $this->geturl(1) !== 'edit'
|
|
||||||
) {
|
|
||||||
$leftItems .= '<li>' . template::ico('clone', [
|
|
||||||
'href' => helper::baseUrl() . 'page/duplicate/' . $this->getUrl(0) . '/' . self::$siteContent,
|
|
||||||
'help' => 'Dupliquer la page'
|
|
||||||
])
|
|
||||||
. '</li>';
|
|
||||||
}
|
|
||||||
// Bouton Effacer une page
|
|
||||||
if (
|
|
||||||
$this->getUser('permission', 'page', 'delete')
|
|
||||||
and $this->geturl(1) !== 'edit'
|
|
||||||
|
|
||||||
) {
|
|
||||||
$leftItems .= '<li>' . template::ico('trash', [
|
|
||||||
'href' => helper::baseUrl() . 'page/delete/' . $this->getUrl(0) . '/' . self::$siteContent,
|
|
||||||
'help' => 'Supprimer la page',
|
|
||||||
'id' => 'pageDelete'
|
|
||||||
])
|
|
||||||
. '</li>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// Bouton Editer le module d'une page
|
||||||
|
if (
|
||||||
|
$this->getUser('permission', 'page', 'module')
|
||||||
|
and $this->geturl(1) !== 'edit'
|
||||||
|
and $this->getData(['page', $this->getUrl(0), 'moduleId'])
|
||||||
|
) {
|
||||||
|
$leftItems .= '<li>' . template::ico('gear', [
|
||||||
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||||
|
'help' => 'Module de la page'
|
||||||
|
]) . '</li>';
|
||||||
|
}
|
||||||
|
// Bouton dupliquer une page
|
||||||
|
if (
|
||||||
|
$this->getUser('permission', 'page', 'duplicate')
|
||||||
|
and $this->geturl(1) !== 'edit'
|
||||||
|
) {
|
||||||
|
$leftItems .= '<li>' . template::ico('clone', [
|
||||||
|
'href' => helper::baseUrl() . 'page/duplicate/' . $this->getUrl(0) . '/' . self::$siteContent,
|
||||||
|
'help' => 'Dupliquer la page'
|
||||||
|
])
|
||||||
|
. '</li>';
|
||||||
|
}
|
||||||
|
// Bouton Effacer une page
|
||||||
|
if (
|
||||||
|
$this->getUser('permission', 'page', 'delete')
|
||||||
|
and $this->geturl(1) !== 'edit'
|
||||||
|
|
||||||
|
) {
|
||||||
|
$leftItems .= '<li>' . template::ico('trash', [
|
||||||
|
'href' => helper::baseUrl() . 'page/delete/' . $this->getUrl(0) . '/' . self::$siteContent,
|
||||||
|
'help' => 'Supprimer la page',
|
||||||
|
'id' => 'pageDelete'
|
||||||
|
])
|
||||||
|
. '</li>';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Items de droite
|
// Items de droite
|
||||||
$rightItems = '';
|
$rightItems = '';
|
||||||
@ -1076,7 +1086,7 @@ class layout extends common
|
|||||||
) {
|
) {
|
||||||
$rightItems .= '<li>' . template::ico('folder', [
|
$rightItems .= '<li>' . template::ico('folder', [
|
||||||
'help' => 'Fichiers',
|
'help' => 'Fichiers',
|
||||||
'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']) . '&fldr=/' . self::$siteContent,
|
'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']) . '&fldr=/' . self::$siteContent,
|
||||||
'attr' => 'data-lity'
|
'attr' => 'data-lity'
|
||||||
]) . '</li>';
|
]) . '</li>';
|
||||||
}
|
}
|
||||||
@ -1084,22 +1094,18 @@ class layout extends common
|
|||||||
self::$siteContent === 'home'
|
self::$siteContent === 'home'
|
||||||
&& $this->getUser('group') >= self::GROUP_ADMIN
|
&& $this->getUser('group') >= self::GROUP_ADMIN
|
||||||
) {
|
) {
|
||||||
$rightItems .= '<li>' . template::ico('puzzle', [
|
|
||||||
'help' => 'Modules',
|
|
||||||
'href' => helper::baseUrl() . 'plugin'
|
|
||||||
]) . '</li>';
|
|
||||||
$rightItems .= '<li>' . template::ico('flag', [
|
$rightItems .= '<li>' . template::ico('flag', [
|
||||||
'help' => 'Langues',
|
'help' => 'Langues',
|
||||||
'href' => helper::baseUrl() . 'language'
|
'href' => helper::baseUrl() . 'language'
|
||||||
]) . '</li>';
|
]) . '</li>';
|
||||||
$rightItems .= '<li>' . template::ico('cog-alt', [
|
|
||||||
'help' => 'Configuration',
|
|
||||||
'href' => helper::baseUrl() . 'config'
|
|
||||||
]) . '</li>';
|
|
||||||
$rightItems .= '<li>' . template::ico('users', [
|
$rightItems .= '<li>' . template::ico('users', [
|
||||||
'help' => 'Utilisateurs',
|
'help' => 'Utilisateurs',
|
||||||
'href' => helper::baseUrl() . 'user'
|
'href' => helper::baseUrl() . 'user'
|
||||||
]) . '</li>';
|
]) . '</li>';
|
||||||
|
$rightItems .= '<li>' . template::ico('cog-alt', [
|
||||||
|
'help' => 'Configuration',
|
||||||
|
'href' => helper::baseUrl() . 'config'
|
||||||
|
]) . '</li>';
|
||||||
// Mise à jour automatique
|
// Mise à jour automatique
|
||||||
$today = mktime(0, 0, 0);
|
$today = mktime(0, 0, 0);
|
||||||
$checkUpdate = $this->getData(['core', 'lastAutoUpdate']);
|
$checkUpdate = $this->getData(['core', 'lastAutoUpdate']);
|
||||||
@ -1111,21 +1117,54 @@ class layout extends common
|
|||||||
$today > $checkUpdate + $this->getData(['config', 'autoUpdateDelay', 86400])
|
$today > $checkUpdate + $this->getData(['config', 'autoUpdateDelay', 86400])
|
||||||
) {
|
) {
|
||||||
// Dernier auto controle
|
// Dernier auto controle
|
||||||
$this->setData(['core', 'lastAutoUpdate', $today]);
|
$this->setData(['core', 'lastAutoUpdate', $today], false);
|
||||||
if (
|
if (
|
||||||
helper::checkNewVersion(common::ZWII_UPDATE_CHANNEL)
|
helper::checkNewVersion(common::ZWII_UPDATE_CHANNEL)
|
||||||
) {
|
) {
|
||||||
$this->setData(['core', 'updateAvailable', true]);
|
$this->setData(['core', 'updateAvailable', true], false);
|
||||||
}
|
}
|
||||||
|
// Modules installés
|
||||||
|
$infoModules = helper::getModules();
|
||||||
|
// Recherche de mise à jour des modules
|
||||||
|
$store = plugin::getStore();
|
||||||
|
if (is_array($store)) {
|
||||||
|
// Parcourir les données des modules du store
|
||||||
|
foreach ($store as $key => $value) {
|
||||||
|
if (empty($key)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Mise à jour d'un module
|
||||||
|
// Le module est installé et une mise à jour est en ligne
|
||||||
|
if (
|
||||||
|
isset($infoModules[$key])
|
||||||
|
&&
|
||||||
|
version_compare($infoModules[$key]['version'], $value['version'], '<')
|
||||||
|
) {
|
||||||
|
$this->setData(['core', 'updateModuleAvailable', true], false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Sauvegarde la base manuellement
|
||||||
|
$this->saveDB('core');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Afficher le bouton : Mise à jour détectée + activée
|
// Afficher le bouton : Mise à jour détectée + activée
|
||||||
if ($this->getData(['core', 'updateAvailable'])) {
|
if ($this->getData(['core', 'updateAvailable'])) {
|
||||||
$rightItems .= '<li><a href="' . helper::baseUrl() . 'install/update" data-tippy-content="Mettre à jour Zwii ' . common::ZWII_VERSION . ' vers ' . helper::getOnlineVersion(common::ZWII_UPDATE_CHANNEL) . '">' . template::ico('update colorRed') . '</a></li>';
|
$rightItems .= '<li><a href="' . helper::baseUrl() . 'install/update" data-tippy-content="Mettre à jour Zwii ' . common::ZWII_VERSION . ' vers ' . helper::getOnlineVersion(common::ZWII_UPDATE_CHANNEL) . '">' . template::ico('update colorRed') . '</a></li>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->getData(['core', 'updateModuleAvailable'])) {
|
||||||
|
$rightItems .= '<li>' . template::ico('puzzle colorRed', [
|
||||||
|
'help' => 'Modules',
|
||||||
|
'href' => helper::baseUrl() . 'plugin'
|
||||||
|
]) . '</li>';
|
||||||
|
} else {
|
||||||
|
$rightItems .= '<li>' . template::ico('puzzle', [
|
||||||
|
'help' => 'Modules',
|
||||||
|
'href' => helper::baseUrl() . 'plugin'
|
||||||
|
]) . '</li>';
|
||||||
|
}
|
||||||
|
// Boutons depuis le groupe éditeur
|
||||||
if (
|
if (
|
||||||
$this->getUser('group') >= self::GROUP_EDITOR
|
$this->getUser('group') >= self::GROUP_EDITOR
|
||||||
&& $this->getUser('permission', 'user', 'edit')
|
&& $this->getUser('permission', 'user', 'edit')
|
||||||
@ -1213,7 +1252,7 @@ class layout extends common
|
|||||||
$vars = 'var baseUrl = ' . json_encode(helper::baseUrl(false)) . ';';
|
$vars = 'var baseUrl = ' . json_encode(helper::baseUrl(false)) . ';';
|
||||||
$vars .= 'var baseUrlQs = ' . json_encode(helper::baseUrl()) . ';';
|
$vars .= 'var baseUrlQs = ' . json_encode(helper::baseUrl()) . ';';
|
||||||
if (
|
if (
|
||||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
$this->isConnected() === true
|
||||||
and $this->getUser('group') >= self::GROUP_EDITOR
|
and $this->getUser('group') >= self::GROUP_EDITOR
|
||||||
) {
|
) {
|
||||||
$vars .= 'var privateKey = ' . json_encode(md5_file(self::DATA_DIR . 'core.json')) . ';';
|
$vars .= 'var privateKey = ' . json_encode(md5_file(self::DATA_DIR . 'core.json')) . ';';
|
||||||
|
@ -11,7 +11,7 @@ class core extends common
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
// Token CSRF
|
// Token CSRF
|
||||||
if (empty($_SESSION['csrf'])) {
|
if (empty($_SESSION['csrf'])) {
|
||||||
$_SESSION['csrf'] = bin2hex(openssl_random_pseudo_bytes(128));
|
$_SESSION['csrf'] = bin2hex(openssl_random_pseudo_bytes(64));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fuseau horaire
|
// Fuseau horaire
|
||||||
@ -32,8 +32,6 @@ class core extends common
|
|||||||
}
|
}
|
||||||
// Date de la dernière suppression
|
// Date de la dernière suppression
|
||||||
$this->setData(['core', 'lastClearTmp', $lastClearTmp]);
|
$this->setData(['core', 'lastClearTmp', $lastClearTmp]);
|
||||||
// Enregistre les données
|
|
||||||
//$this->SaveData();
|
|
||||||
}
|
}
|
||||||
// Backup automatique des données
|
// Backup automatique des données
|
||||||
$lastBackup = mktime(0, 0, 0);
|
$lastBackup = mktime(0, 0, 0);
|
||||||
@ -423,7 +421,7 @@ class core extends common
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
// Stocke la dernière page vue et sa date de consultation
|
// Stocke la dernière page vue et sa date de consultation
|
||||||
$this->setData(['enrolment', common::$siteContent, $this->getUser('id'), 'lastPageView', $this->getUrl(0)]);
|
$this->setData(['enrolment', common::$siteContent, $this->getUser('id'), 'lastPageView', $this->getUrl(0)], false);
|
||||||
$this->setData(['enrolment', common::$siteContent, $this->getUser('id'), 'datePageView', time()]);
|
$this->setData(['enrolment', common::$siteContent, $this->getUser('id'), 'datePageView', time()]);
|
||||||
|
|
||||||
// Stocke le rapport en CSV
|
// Stocke le rapport en CSV
|
||||||
@ -438,7 +436,7 @@ class core extends common
|
|||||||
|
|
||||||
// Force la déconnexion des membres bannis ou d'une seconde session
|
// Force la déconnexion des membres bannis ou d'une seconde session
|
||||||
if (
|
if (
|
||||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
$this->isConnected() === true
|
||||||
and ($this->getUser('group') === common::GROUP_BANNED
|
and ($this->getUser('group') === common::GROUP_BANNED
|
||||||
or ($_SESSION['csrf'] !== $this->getData(['user', $this->getUser('id'), 'accessCsrf'])
|
or ($_SESSION['csrf'] !== $this->getData(['user', $this->getUser('id'), 'accessCsrf'])
|
||||||
and $this->getData(['config', 'connect', 'autoDisconnect']) === true)
|
and $this->getData(['config', 'connect', 'autoDisconnect']) === true)
|
||||||
@ -452,8 +450,8 @@ class core extends common
|
|||||||
$this->getData(['config', 'maintenance'])
|
$this->getData(['config', 'maintenance'])
|
||||||
and in_array($this->getUrl(0), ['maintenance', 'user']) === false
|
and in_array($this->getUrl(0), ['maintenance', 'user']) === false
|
||||||
and $this->getUrl(1) !== 'login'
|
and $this->getUrl(1) !== 'login'
|
||||||
and ($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
and ($this->isConnected() === false
|
||||||
or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
or ($this->isConnected() === true
|
||||||
and $this->getUser('group') < common::GROUP_ADMIN
|
and $this->getUser('group') < common::GROUP_ADMIN
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -472,7 +470,7 @@ class core extends common
|
|||||||
if ($this->getData(['page', $this->getUrl(0)]) !== null) {
|
if ($this->getData(['page', $this->getUrl(0)]) !== null) {
|
||||||
if (
|
if (
|
||||||
$this->getData(['page', $this->getUrl(0), 'group']) === common::GROUP_VISITOR
|
$this->getData(['page', $this->getUrl(0), 'group']) === common::GROUP_VISITOR
|
||||||
or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
or ($this->isConnected() === true
|
||||||
// and $this->getUser('group') >= $this->getData(['page', $this->getUrl(0), 'group'])
|
// and $this->getUser('group') >= $this->getData(['page', $this->getUrl(0), 'group'])
|
||||||
// Modification qui tient compte du profil de la page
|
// Modification qui tient compte du profil de la page
|
||||||
and ($this->getUser('group') * 10 + $this->getUser('profil')) >= ($this->getData(['page', $this->getUrl(0), 'group']) * 10 + $this->getData(['page', $this->getUrl(0), 'profil']))
|
and ($this->getUser('group') * 10 + $this->getUser('profil')) >= ($this->getData(['page', $this->getUrl(0), 'group']) * 10 + $this->getData(['page', $this->getUrl(0), 'profil']))
|
||||||
@ -489,9 +487,9 @@ class core extends common
|
|||||||
// Empêcher l'accès aux pages désactivées par URL directe
|
// Empêcher l'accès aux pages désactivées par URL directe
|
||||||
if (
|
if (
|
||||||
($this->getData(['page', $this->getUrl(0), 'disable']) === true
|
($this->getData(['page', $this->getUrl(0), 'disable']) === true
|
||||||
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
and $this->isConnected() === false
|
||||||
) or ($this->getData(['page', $this->getUrl(0), 'disable']) === true
|
) or ($this->getData(['page', $this->getUrl(0), 'disable']) === true
|
||||||
and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
and $this->isConnected() === true
|
||||||
and $this->getUser('group') < common::GROUP_EDITOR
|
and $this->getUser('group') < common::GROUP_EDITOR
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@ -505,6 +503,22 @@ class core extends common
|
|||||||
) {
|
) {
|
||||||
$access = false;
|
$access = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Empêche la consultation d'un espace laissé ouvert après la déconnexion et redirige vers home
|
||||||
|
* L'utilisateur n'est pas connecté
|
||||||
|
* ET l'accueil n'est pas affiché
|
||||||
|
* ET l'espace affiché nécessite un compte d'accès, enrolment vaut 1,2 ou 3
|
||||||
|
* */
|
||||||
|
|
||||||
|
if (
|
||||||
|
$this->isConnected() === false
|
||||||
|
and self::$siteContent !== 'home'
|
||||||
|
and $this->getData(['course', self::$siteContent, 'enrolment']) > 0
|
||||||
|
) {
|
||||||
|
$_SESSION['ZWII_SITE_CONTENT'] = 'home';
|
||||||
|
header(header: 'Location:' . helper::baseUrl(true) . 'swap/' . self::$siteContent);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -538,10 +552,11 @@ class core extends common
|
|||||||
}
|
}
|
||||||
// Accès concurrent stocke la page visitée
|
// Accès concurrent stocke la page visitée
|
||||||
if (
|
if (
|
||||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
$this->isConnected() === true
|
||||||
&& $this->getUser('id')
|
&& $this->getUser('id')
|
||||||
|
&& !$this->isPost()
|
||||||
) {
|
) {
|
||||||
$this->setData(['user', $this->getUser('id'), 'accessUrl', $this->getUrl()]);
|
$this->setData(['user', $this->getUser('id'), 'accessUrl', $this->getUrl()], false);
|
||||||
$this->setData(['user', $this->getUser('id'), 'accessTimer', time()]);
|
$this->setData(['user', $this->getUser('id'), 'accessTimer', time()]);
|
||||||
}
|
}
|
||||||
// Breadcrumb
|
// Breadcrumb
|
||||||
@ -658,7 +673,7 @@ class core extends common
|
|||||||
// Check le groupe de l'utilisateur
|
// Check le groupe de l'utilisateur
|
||||||
if (
|
if (
|
||||||
($module::$actions[$action] === common::GROUP_VISITOR
|
($module::$actions[$action] === common::GROUP_VISITOR
|
||||||
or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
or ($this->isConnected() === true
|
||||||
and $this->getUser('group') >= $module::$actions[$action]
|
and $this->getUser('group') >= $module::$actions[$action]
|
||||||
and $this->getUser('permission', $moduleId, $action)
|
and $this->getUser('permission', $moduleId, $action)
|
||||||
)
|
)
|
||||||
|
@ -128,7 +128,17 @@ class SitemapGenerator
|
|||||||
*/
|
*/
|
||||||
private $sampleRobotsLines = [
|
private $sampleRobotsLines = [
|
||||||
"User-agent: *",
|
"User-agent: *",
|
||||||
|
"Disallow: /",
|
||||||
|
"User-agent: Googlebot",
|
||||||
"Allow: /",
|
"Allow: /",
|
||||||
|
"User-agent: bingbot",
|
||||||
|
"Allow: /",
|
||||||
|
"User-agent: Slurp",
|
||||||
|
"Allow: /",
|
||||||
|
"User-agent: DuckDuckBot",
|
||||||
|
"Allow: /",
|
||||||
|
"User-agent: Baiduspider",
|
||||||
|
"Allow: /"
|
||||||
];
|
];
|
||||||
/**
|
/**
|
||||||
* @var array list of valid changefreq values according to the spec
|
* @var array list of valid changefreq values according to the spec
|
||||||
|
@ -216,15 +216,16 @@ core.start = function () {
|
|||||||
// Variables des cookies
|
// Variables des cookies
|
||||||
var getUrl = window.location;
|
var getUrl = window.location;
|
||||||
var domain = "domain=" + getUrl.hostname + ";";
|
var domain = "domain=" + getUrl.hostname + ";";
|
||||||
|
var basePath = getUrl.pathname.substring(0, getUrl.pathname.lastIndexOf('/') + 1);
|
||||||
|
var path = "path=" + basePath + ";";
|
||||||
var e = new Date();
|
var e = new Date();
|
||||||
e.setFullYear(e.getFullYear() + 1);
|
e.setFullYear(e.getFullYear() + 1);
|
||||||
var expires = "expires=" + e.toUTCString();
|
var expires = "expires=" + e.toUTCString() + ";";
|
||||||
|
|
||||||
// Stocke le cookie d'acceptation
|
// Stocke le cookie d'acceptation
|
||||||
document.cookie = "ZWII_COOKIE_CONSENT=true;samesite=strict;" + domain + expires;
|
document.cookie = "ZWII_COOKIE_CONSENT=true; samesite=lax; " + domain + path + expires;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fermeture de la popup des cookies
|
* Fermeture de la popup des cookies
|
||||||
*/
|
*/
|
||||||
|
124
core/core.php
124
core/core.php
@ -51,7 +51,7 @@ class common
|
|||||||
const ACCESS_TIMER = 1800;
|
const ACCESS_TIMER = 1800;
|
||||||
|
|
||||||
// Numéro de version
|
// Numéro de version
|
||||||
const ZWII_VERSION = '1.11.02';
|
const ZWII_VERSION = '1.14.04';
|
||||||
|
|
||||||
// URL autoupdate
|
// URL autoupdate
|
||||||
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';
|
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';
|
||||||
@ -320,29 +320,58 @@ class common
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Construct cache
|
||||||
|
if (isset($GLOBALS['common_construct'])) {
|
||||||
|
$this->input['_POST'] = $GLOBALS['common_construct']['input']['_POST'];
|
||||||
|
$this->input['_COOKIE'] = $GLOBALS['common_construct']['input']['_COOKIE'];
|
||||||
|
self::$siteContent = $GLOBALS['common_construct']['siteContent'];
|
||||||
|
$this->dataFiles = $GLOBALS['common_construct']['dataFiles'];
|
||||||
|
$this->configFiles = $GLOBALS['common_construct']['configFiles'];
|
||||||
|
$this->user = $GLOBALS['common_construct']['user'];
|
||||||
|
self::$i18nUI = $GLOBALS['common_construct']['i18nUI'];
|
||||||
|
$this->hierarchy = $GLOBALS['common_construct']['hierarchy'];
|
||||||
|
$this->url = $GLOBALS['common_construct']['url'];
|
||||||
|
self::$dialog = $GLOBALS['common_construct']['dialog'];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Extraction des données http
|
// Extraction des données http
|
||||||
if (isset($_POST)) {
|
if (isset($_POST)) {
|
||||||
$this->input['_POST'] = $_POST;
|
$this->input['_POST'] = $_POST;
|
||||||
|
// Cache
|
||||||
|
$GLOBALS['common_construct']['input']['_POST'] = $this->input['_POST'];
|
||||||
}
|
}
|
||||||
if (isset($_COOKIE)) {
|
if (isset($_COOKIE)) {
|
||||||
$this->input['_COOKIE'] = $_COOKIE;
|
$this->input['_COOKIE'] = $_COOKIE;
|
||||||
|
// Cache
|
||||||
|
$GLOBALS['common_construct']['input']['_COOKIE'] = $this->input['_COOKIE'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Déterminer le contenu du site
|
// Déterminer le contenu du site
|
||||||
if (isset($_SESSION['ZWII_SITE_CONTENT'])) {
|
if (isset($_SESSION['ZWII_SITE_CONTENT'])) {
|
||||||
// Déterminé par la session présente
|
// Déterminé par la session présente
|
||||||
self::$siteContent = $_SESSION['ZWII_SITE_CONTENT'];
|
self::$siteContent = $_SESSION['ZWII_SITE_CONTENT'];
|
||||||
|
} else {
|
||||||
|
$_SESSION['ZWII_SITE_CONTENT'] = 'home';
|
||||||
|
self::$siteContent = 'home';
|
||||||
}
|
}
|
||||||
|
// Cache
|
||||||
|
$GLOBALS['common_construct']['siteContent'] = self::$siteContent;
|
||||||
|
|
||||||
// Instanciation de la classe des entrées / sorties
|
// Instanciation de la classe des entrées / sorties
|
||||||
// Les fichiers de configuration
|
// Les fichiers de configuration
|
||||||
foreach ($this->configFiles as $module => $value) {
|
foreach ($this->configFiles as $module => $value) {
|
||||||
$this->initDB($module);
|
$this->initDB($module);
|
||||||
}
|
}
|
||||||
|
// Cache
|
||||||
|
$GLOBALS['common_construct']['configFiles'] = $this->configFiles;
|
||||||
// Les fichiers des contenus
|
// Les fichiers des contenus
|
||||||
foreach ($this->contentFiles as $module => $value) {
|
foreach ($this->contentFiles as $module => $value) {
|
||||||
$this->initDB($module, self::$siteContent);
|
$this->initDB($module, self::$siteContent);
|
||||||
}
|
}
|
||||||
|
// Cache
|
||||||
|
$GLOBALS['common_construct']['dataFiles'] = $this->dataFiles;
|
||||||
|
|
||||||
|
|
||||||
// Installation fraîche, initialisation de la configuration inexistante
|
// Installation fraîche, initialisation de la configuration inexistante
|
||||||
// Nécessaire pour le constructeur
|
// Nécessaire pour le constructeur
|
||||||
@ -368,6 +397,8 @@ class common
|
|||||||
if ($this->user === []) {
|
if ($this->user === []) {
|
||||||
$this->user = $this->getData(['user', $this->getInput('ZWII_USER_ID')]);
|
$this->user = $this->getData(['user', $this->getInput('ZWII_USER_ID')]);
|
||||||
}
|
}
|
||||||
|
// Cache
|
||||||
|
$GLOBALS['common_construct']['user'] = $this->user;
|
||||||
|
|
||||||
// Langue de l'administration si le user est connecté
|
// Langue de l'administration si le user est connecté
|
||||||
if ($this->getData(['user', $this->getUser('id'), 'language'])) {
|
if ($this->getData(['user', $this->getUser('id'), 'language'])) {
|
||||||
@ -390,13 +421,17 @@ class common
|
|||||||
// Stocker le cookie de langue pour l'éditeur de texte ainsi que l'url du contenu pour le theme
|
// Stocker le cookie de langue pour l'éditeur de texte ainsi que l'url du contenu pour le theme
|
||||||
setcookie('ZWII_UI', self::$i18nUI, time() + 3600, '', '', false, false);
|
setcookie('ZWII_UI', self::$i18nUI, time() + 3600, '', '', false, false);
|
||||||
// Stocker l'courseId pour le thème de TinyMCE
|
// Stocker l'courseId pour le thème de TinyMCE
|
||||||
setcookie('ZWII_SITE_CONTENT', self::$siteContent, time() + 3600, '', '', false, false);
|
//setcookie('ZWII_SITE_CONTENT', self::$siteContent, time() + 3600, '', '', false, false);
|
||||||
setlocale(LC_ALL, self::$i18nUI);
|
setlocale(LC_ALL, self::$i18nUI);
|
||||||
|
// Cache
|
||||||
|
$GLOBALS['common_construct']['i18nUI'] = self::$i18nUI;
|
||||||
|
|
||||||
// Construit la liste des pages parents/enfants
|
// Construit la liste des pages parents/enfants
|
||||||
if ($this->hierarchy['all'] === []) {
|
if ($this->hierarchy['all'] === []) {
|
||||||
$this->buildHierarchy();
|
$this->buildHierarchy();
|
||||||
}
|
}
|
||||||
|
// Cache
|
||||||
|
$GLOBALS['common_construct']['hierarchy'] = $this->hierarchy;
|
||||||
|
|
||||||
// Construit l'url
|
// Construit l'url
|
||||||
if ($this->url === '') {
|
if ($this->url === '') {
|
||||||
@ -406,6 +441,8 @@ class common
|
|||||||
$this->url = $this->homePageId();
|
$this->url = $this->homePageId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Cache
|
||||||
|
$GLOBALS['common_construct']['url'] = $this->url;
|
||||||
|
|
||||||
// Chargement des dialogues
|
// Chargement des dialogues
|
||||||
if (!file_exists(self::I18N_DIR . self::$i18nUI . '.json')) {
|
if (!file_exists(self::I18N_DIR . self::$i18nUI . '.json')) {
|
||||||
@ -425,6 +462,8 @@ class common
|
|||||||
self::$dialog = array_merge(self::$dialog, $d);
|
self::$dialog = array_merge(self::$dialog, $d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Cache
|
||||||
|
$GLOBALS['common_construct']['dialog'] = self::$dialog;
|
||||||
|
|
||||||
// Données de proxy
|
// Données de proxy
|
||||||
$proxy = $this->getData(['config', 'proxyType']) . $this->getData(['config', 'proxyUrl']) . ':' . $this->getData(['config', 'proxyPort']);
|
$proxy = $this->getData(['config', 'proxyType']) . $this->getData(['config', 'proxyUrl']) . ':' . $this->getData(['config', 'proxyPort']);
|
||||||
@ -448,12 +487,10 @@ class common
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mise à jour des données core
|
// Mise à jour des données core
|
||||||
include ('core/include/update.inc.php');
|
include('core/include/update.inc.php');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajoute les valeurs en sortie
|
* Ajoute les valeurs en sortie
|
||||||
* @param array $output Valeurs en sortie
|
* @param array $output Valeurs en sortie
|
||||||
@ -513,8 +550,10 @@ class common
|
|||||||
/**
|
/**
|
||||||
* Sauvegarde des données
|
* Sauvegarde des données
|
||||||
* @param array $keys Clé(s) des données
|
* @param array $keys Clé(s) des données
|
||||||
|
* @param bool $save Indique si le fichier doit être sauvegardé après modification (par défaut true)
|
||||||
|
* @return bool Succès de l'opération
|
||||||
*/
|
*/
|
||||||
public function setData($keys = [])
|
public function setData($keys = [], $save = true)
|
||||||
{
|
{
|
||||||
// Pas d'enregistrement lorsqu'une notice est présente ou tableau transmis vide
|
// Pas d'enregistrement lorsqu'une notice est présente ou tableau transmis vide
|
||||||
if (
|
if (
|
||||||
@ -542,11 +581,12 @@ class common
|
|||||||
$query .= '.' . $keys[$i];
|
$query .= '.' . $keys[$i];
|
||||||
}
|
}
|
||||||
// Appliquer la modification, le dernier élément étant la donnée à sauvegarder
|
// Appliquer la modification, le dernier élément étant la donnée à sauvegarder
|
||||||
$success = is_object($db->set($query, $keys[count($keys) - 1], true));
|
$success = is_object($db->set($query, $keys[count($keys) - 1], $save));
|
||||||
}
|
}
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accède aux données
|
* Accède aux données
|
||||||
* @param array $keys Clé(s) des données
|
* @param array $keys Clé(s) des données
|
||||||
@ -590,7 +630,7 @@ class common
|
|||||||
/**
|
/**
|
||||||
* Ecrire les données de la page
|
* Ecrire les données de la page
|
||||||
* @param string pageId
|
* @param string pageId
|
||||||
* @param string contenu de la page
|
* @param array contenu de la page
|
||||||
* @return int nombre d'octets écrits ou erreur
|
* @return int nombre d'octets écrits ou erreur
|
||||||
*/
|
*/
|
||||||
public function setPage($page, $value, $path)
|
public function setPage($page, $value, $path)
|
||||||
@ -616,7 +656,7 @@ class common
|
|||||||
* Écrit les données dans un fichier avec plusieurs tentatives d'écriture et verrouillage
|
* Écrit les données dans un fichier avec plusieurs tentatives d'écriture et verrouillage
|
||||||
*
|
*
|
||||||
* @param string $filename Le nom du fichier
|
* @param string $filename Le nom du fichier
|
||||||
* @param array $data Les données à écrire dans le fichier
|
* @param string $data Les données à écrire dans le fichier
|
||||||
* @param int $flags Les drapeaux optionnels à passer à la fonction $this->secure_file_put_contents
|
* @param int $flags Les drapeaux optionnels à passer à la fonction $this->secure_file_put_contents
|
||||||
* @return bool True si l'écriture a réussi, sinon false
|
* @return bool True si l'écriture a réussi, sinon false
|
||||||
*/
|
*/
|
||||||
@ -626,45 +666,60 @@ class common
|
|||||||
// Initialise le compteur de tentatives
|
// Initialise le compteur de tentatives
|
||||||
$attempts = 0;
|
$attempts = 0;
|
||||||
|
|
||||||
// Convertit les données en chaîne de caractères
|
|
||||||
$serialized_data = serialize($data);
|
|
||||||
|
|
||||||
// Vérifie la longueur des données
|
// Vérifie la longueur des données
|
||||||
$data_length = strlen($serialized_data);
|
$data_length = strlen($data);
|
||||||
|
|
||||||
// Effectue jusqu'à 5 tentatives d'écriture
|
// Effectue jusqu'à 5 tentatives d'écriture
|
||||||
while ($attempts < 5) {
|
while ($attempts < 5) {
|
||||||
// Essaye d'écrire les données dans le fichier avec verrouillage exclusif
|
// Essaye d'écrire les données dans le fichier avec verrouillage exclusif
|
||||||
$write_result = file_put_contents($filename, $data, LOCK_EX | $flags);
|
$write_result = file_put_contents($filename, $data, LOCK_EX | $flags);
|
||||||
|
|
||||||
|
// $now = \DateTime::createFromFormat('U.u', microtime(true));
|
||||||
|
// file_put_contents("tmplog.txt", '[SecurePut][' . $now->format('H:i:s.u') . ']' . "\r\n", FILE_APPEND);
|
||||||
|
|
||||||
// Vérifie si l'écriture a réussi
|
// Vérifie si l'écriture a réussi
|
||||||
if ($write_result !== false && $write_result === $data_length) {
|
if ($write_result !== false && $write_result === $data_length) {
|
||||||
// Sort de la boucle si l'écriture a réussi
|
// Sort de la boucle si l'écriture a réussi
|
||||||
return true;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incrémente le compteur de tentatives
|
// Incrémente le compteur de tentatives
|
||||||
$attempts++;
|
$attempts++;
|
||||||
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
// Etat de l'écriture
|
||||||
// Échec de l'écriture après plusieurs tentatives
|
return ($attempts < 5);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function initDB($module, $path = '')
|
public function initDB($module, $path = '')
|
||||||
{
|
{
|
||||||
// Instanciation de la classe des entrées / sorties
|
// Chemin complet vers le fichier JSON
|
||||||
// Constructeur JsonDB;
|
$dir = empty($path) ? self::DATA_DIR : self::DATA_DIR . $path . '/';
|
||||||
$this->dataFiles[$module] = new \Prowebcraft\JsonDb([
|
$config = [
|
||||||
'name' => $module . '.json',
|
'name' => $module . '.json',
|
||||||
'dir' => empty($path) ? self::DATA_DIR : self::DATA_DIR . $path . '/',
|
'dir' => $dir,
|
||||||
'backup' => file_exists('site/data/.backup')
|
'backup' => file_exists('site/data/.backup'),
|
||||||
]);
|
'update' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
// Instanciation de l'objet et stockage dans dataFiles
|
||||||
|
$this->dataFiles[$module] = new \Prowebcraft\JsonDb($config);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cette fonction est liée à saveData
|
||||||
|
* @param mixed $module
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function saveDB($module): void
|
||||||
|
{
|
||||||
|
$db = $this->dataFiles[$module];
|
||||||
|
$db->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialisation des données sur un contenu ou la page d'accueil
|
* Initialisation des données sur un contenu ou la page d'accueil
|
||||||
* @param string $course : id du module à générer
|
* @param string $course : id du module à générer
|
||||||
@ -676,7 +731,7 @@ class common
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Tableau avec les données vierges
|
// Tableau avec les données vierges
|
||||||
require_once ('core/module/install/ressource/defaultdata.php');
|
require_once('core/module/install/ressource/defaultdata.php');
|
||||||
|
|
||||||
// L'arborescence
|
// L'arborescence
|
||||||
if (!file_exists(self::DATA_DIR . $path)) {
|
if (!file_exists(self::DATA_DIR . $path)) {
|
||||||
@ -711,7 +766,7 @@ class common
|
|||||||
public function saveConfig($module)
|
public function saveConfig($module)
|
||||||
{
|
{
|
||||||
// Tableau avec les données vierges
|
// Tableau avec les données vierges
|
||||||
require_once ('core/module/install/ressource/defaultdata.php');
|
require_once('core/module/install/ressource/defaultdata.php');
|
||||||
// Installation des données des autres modules cad theme profil font config, admin et core
|
// Installation des données des autres modules cad theme profil font config, admin et core
|
||||||
$this->setData([$module, init::$defaultData[$module]]);
|
$this->setData([$module, init::$defaultData[$module]]);
|
||||||
common::$coreNotices[] = $module;
|
common::$coreNotices[] = $module;
|
||||||
@ -758,7 +813,7 @@ class common
|
|||||||
$this->getData(['page', $pageId, 'parentPageId']) === ""
|
$this->getData(['page', $pageId, 'parentPageId']) === ""
|
||||||
// Ignore les pages dont l'utilisateur n'a pas accès
|
// Ignore les pages dont l'utilisateur n'a pas accès
|
||||||
and ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR
|
and ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR
|
||||||
or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
or ($this->getUser('authKey') === $this->getInput('ZWII_AUTH_KEY')
|
||||||
//and $this->getUser('group') >= $this->getData(['page', $pageId, 'group'])
|
//and $this->getUser('group') >= $this->getData(['page', $pageId, 'group'])
|
||||||
// Modification qui tient compte du profil de la page
|
// Modification qui tient compte du profil de la page
|
||||||
and ($this->getUser('group') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $pageId, 'group']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil']))
|
and ($this->getUser('group') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $pageId, 'group']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil']))
|
||||||
@ -789,7 +844,7 @@ class common
|
|||||||
$this->getData(['page', $parentId, 'group']) === self::GROUP_VISITOR
|
$this->getData(['page', $parentId, 'group']) === self::GROUP_VISITOR
|
||||||
)
|
)
|
||||||
or (
|
or (
|
||||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
$this->getUser('authKey') === $this->getInput('ZWII_AUTH_KEY')
|
||||||
and
|
and
|
||||||
$this->getUser('group') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $pageId, 'group']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil'])
|
$this->getUser('group') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $pageId, 'group']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil'])
|
||||||
|
|
||||||
@ -1015,6 +1070,17 @@ class common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool l'utilisateur est connecté true sinon false
|
||||||
|
*/
|
||||||
|
public function isConnected()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
!empty($this->getUser('authKey'))
|
||||||
|
&&
|
||||||
|
$this->getUser('authKey') === $this->getInput('ZWII_AUTH_KEY'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check qu'une valeur est transmise par la méthode _POST
|
* Check qu'une valeur est transmise par la méthode _POST
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html prefix="og: http://ogp.me/ns#" lang="fr_FR">
|
<html prefix="og: http://ogp.me/ns#" lang="fr_FR">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html;">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<?php $layout->showMetaTitle(); ?>
|
<?php $layout->showMetaTitle(); ?>
|
||||||
<?php $layout->showMetaDescription(); ?>
|
<?php $layout->showMetaDescription(); ?>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html prefix="og: http://ogp.me/ns#" lang="fr_FR">
|
<html prefix="og: http://ogp.me/ns#" lang="fr_FR">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html;">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<?php $layout->showMetaTitle(); ?>
|
<?php $layout->showMetaTitle(); ?>
|
||||||
<?php $layout->showMetaDescription(); ?>
|
<?php $layout->showMetaDescription(); ?>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr_FR">
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr_FR">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html;">
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="x-apple-disable-message-reformatting">
|
<meta name="x-apple-disable-message-reformatting">
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html prefix="og: http://ogp.me/ns#" lang="fr_FR">
|
<html prefix="og: http://ogp.me/ns#" lang="fr_FR">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html;">
|
||||||
<meta meta="description=" content="ZwiiCMS le CMS multilingue sans base de données">
|
<meta meta="description=" content="ZwiiCMS le CMS multilingue sans base de données">
|
||||||
<meta name="generator" content="ZiiCMS https://forge.chapril.org/ZwiiCMS-Team/ZwiiCMS">
|
<meta name="generator" content="ZiiCMS https://forge.chapril.org/ZwiiCMS-Team/ZwiiCMS">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
@ -47,7 +47,7 @@
|
|||||||
if (
|
if (
|
||||||
$this->getData(['theme', 'menu', 'position']) === 'top'
|
$this->getData(['theme', 'menu', 'position']) === 'top'
|
||||||
and $this->getData(['theme', 'menu', 'fixed']) === true
|
and $this->getData(['theme', 'menu', 'fixed']) === true
|
||||||
and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
and $this->isConnected() === true
|
||||||
and $this->getUser('group') > self::GROUP_MEMBER
|
and $this->getUser('group') > self::GROUP_MEMBER
|
||||||
) {
|
) {
|
||||||
echo '<nav id="navfixedconnected" >';
|
echo '<nav id="navfixedconnected" >';
|
||||||
|
@ -22,7 +22,7 @@ class config extends common
|
|||||||
'copyBackups' => self::GROUP_ADMIN,
|
'copyBackups' => self::GROUP_ADMIN,
|
||||||
'delBackups' => self::GROUP_ADMIN,
|
'delBackups' => self::GROUP_ADMIN,
|
||||||
'configMetaImage' => self::GROUP_ADMIN,
|
'configMetaImage' => self::GROUP_ADMIN,
|
||||||
'siteMap' => self::GROUP_ADMIN,
|
'sitemap' => self::GROUP_ADMIN,
|
||||||
'index' => self::GROUP_ADMIN,
|
'index' => self::GROUP_ADMIN,
|
||||||
'restore' => self::GROUP_ADMIN,
|
'restore' => self::GROUP_ADMIN,
|
||||||
'updateBaseUrl' => self::GROUP_ADMIN,
|
'updateBaseUrl' => self::GROUP_ADMIN,
|
||||||
@ -30,7 +30,8 @@ class config extends common
|
|||||||
'logReset' => self::GROUP_ADMIN,
|
'logReset' => self::GROUP_ADMIN,
|
||||||
'logDownload' => self::GROUP_ADMIN,
|
'logDownload' => self::GROUP_ADMIN,
|
||||||
'blacklistReset' => self::GROUP_ADMIN,
|
'blacklistReset' => self::GROUP_ADMIN,
|
||||||
'blacklistDownload' => self::GROUP_ADMIN
|
'blacklistDownload' => self::GROUP_ADMIN,
|
||||||
|
'register' => self::GROUP_ADMIN,
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $timezones = [
|
public static $timezones = [
|
||||||
@ -213,7 +214,7 @@ class config extends common
|
|||||||
* Sitemap compressé et non compressé
|
* Sitemap compressé et non compressé
|
||||||
* Robots.txt
|
* Robots.txt
|
||||||
*/
|
*/
|
||||||
public function siteMap()
|
public function sitemap()
|
||||||
{
|
{
|
||||||
// La page n'existe pas
|
// La page n'existe pas
|
||||||
if (
|
if (
|
||||||
@ -592,7 +593,7 @@ class config extends common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Générer robots.txt et sitemap
|
// Générer robots.txt et sitemap
|
||||||
$this->siteMap();
|
$this->sitemap();
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => helper::translate('Configuration'),
|
'title' => helper::translate('Configuration'),
|
||||||
@ -972,4 +973,25 @@ class config extends common
|
|||||||
return getenv('HTTP_MOD_REWRITE') == 'On' || getenv('REDIRECT_STATUS') == '200';
|
return getenv('HTTP_MOD_REWRITE') == 'On' || getenv('REDIRECT_STATUS') == '200';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stocke la variable dans les paramètres de l'utilisateur pour activer la tab à sa prochaine visite
|
||||||
|
* @return never
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
$this->setData([
|
||||||
|
'user',
|
||||||
|
$this->getUser('id'),
|
||||||
|
'view',
|
||||||
|
[
|
||||||
|
'config' => $this->getUrl(2),
|
||||||
|
'page' => $this->getData(['user', $this->getUser('id'), 'view', 'page']),
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'redirect' => helper::baseUrl() . 'config/' . $this->getUrl(2),
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
@ -66,11 +66,12 @@ $(document).ready(function () {
|
|||||||
$("#connectCaptchaStrong").prop("checked", false);
|
$("#connectCaptchaStrong").prop("checked", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var configLayout = getCookie("configLayout");
|
var configLayout = "<?php echo $this->getData(['user', $this->getUser('id'), 'view', 'config']);?>";
|
||||||
if (configLayout == null) {
|
// Non défini, valeur par défaut
|
||||||
configLayout = "locale";
|
if (configLayout == "") {
|
||||||
setCookie("configLayout", "locale");
|
configLayout = "setup";
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#localeContainer").hide();
|
$("#localeContainer").hide();
|
||||||
$("#socialContainer").hide();
|
$("#socialContainer").hide();
|
||||||
$("#connectContainer").hide();
|
$("#connectContainer").hide();
|
||||||
@ -168,7 +169,6 @@ $(document).ready(function () {
|
|||||||
$("#configSocialButton").removeClass("activeButton");
|
$("#configSocialButton").removeClass("activeButton");
|
||||||
$("#configConnectButton").removeClass("activeButton");
|
$("#configConnectButton").removeClass("activeButton");
|
||||||
$("#configNetworkButton").removeClass("activeButton");
|
$("#configNetworkButton").removeClass("activeButton");
|
||||||
setCookie("configLayout", "locale");
|
|
||||||
});
|
});
|
||||||
$("#configSetupButton").on("click", function () {
|
$("#configSetupButton").on("click", function () {
|
||||||
$("#localeContainer").hide();
|
$("#localeContainer").hide();
|
||||||
@ -181,7 +181,6 @@ $(document).ready(function () {
|
|||||||
$("#configSocialButton").removeClass("activeButton");
|
$("#configSocialButton").removeClass("activeButton");
|
||||||
$("#configConnectButton").removeClass("activeButton");
|
$("#configConnectButton").removeClass("activeButton");
|
||||||
$("#configNetworkButton").removeClass("activeButton");
|
$("#configNetworkButton").removeClass("activeButton");
|
||||||
setCookie("configLayout", "setup");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#configSocialButton").on("click", function () {
|
$("#configSocialButton").on("click", function () {
|
||||||
@ -195,7 +194,6 @@ $(document).ready(function () {
|
|||||||
$("#configSocialButton").addClass("activeButton");
|
$("#configSocialButton").addClass("activeButton");
|
||||||
$("#configConnectButton").removeClass("activeButton");
|
$("#configConnectButton").removeClass("activeButton");
|
||||||
$("#configNetworkButton").removeClass("activeButton");
|
$("#configNetworkButton").removeClass("activeButton");
|
||||||
setCookie("configLayout", "social");
|
|
||||||
});
|
});
|
||||||
$("#configConnectButton").on("click", function () {
|
$("#configConnectButton").on("click", function () {
|
||||||
$("#setupContainer").hide();
|
$("#setupContainer").hide();
|
||||||
@ -208,7 +206,6 @@ $(document).ready(function () {
|
|||||||
$("#configSocialButton").removeClass("activeButton");
|
$("#configSocialButton").removeClass("activeButton");
|
||||||
$("#configConnectButton").addClass("activeButton");
|
$("#configConnectButton").addClass("activeButton");
|
||||||
$("#configNetworkButton").removeClass("activeButton");
|
$("#configNetworkButton").removeClass("activeButton");
|
||||||
setCookie("configLayout", "connect");
|
|
||||||
});
|
});
|
||||||
$("#configNetworkButton").on("click", function () {
|
$("#configNetworkButton").on("click", function () {
|
||||||
$("#setupContainer").hide();
|
$("#setupContainer").hide();
|
||||||
@ -221,7 +218,6 @@ $(document).ready(function () {
|
|||||||
$("#configSocialButton").removeClass("activeButton");
|
$("#configSocialButton").removeClass("activeButton");
|
||||||
$("#configConnectButton").removeClass("activeButton");
|
$("#configConnectButton").removeClass("activeButton");
|
||||||
$("#configNetworkButton").addClass("activeButton");
|
$("#configNetworkButton").addClass("activeButton");
|
||||||
setCookie("configLayout", "network");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -308,27 +304,6 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function setCookie(name, value, days) {
|
|
||||||
var expires = "";
|
|
||||||
if (days) {
|
|
||||||
var date = new Date();
|
|
||||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
||||||
expires = "; expires=" + date.toUTCString();
|
|
||||||
}
|
|
||||||
document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCookie(name) {
|
|
||||||
var nameEQ = name + "=";
|
|
||||||
var ca = document.cookie.split(';');
|
|
||||||
for (var i = 0; i < ca.length; i++) {
|
|
||||||
var c = ca[i];
|
|
||||||
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
||||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define function to capitalize the first letter of a string
|
// Define function to capitalize the first letter of a string
|
||||||
function capitalizeFirstLetter(string) {
|
function capitalizeFirstLetter(string) {
|
||||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||||
|
@ -7,44 +7,35 @@
|
|||||||
'value' => template::ico('home')
|
'value' => template::ico('home')
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col1">
|
<div class="col2 offset9">
|
||||||
<?php /**echo template::button('configHelp', [
|
|
||||||
'class' => 'buttonHelp',
|
|
||||||
'href' => 'https://doc.zwiicms.fr/configuration-du-site',
|
|
||||||
'target' => '_blank',
|
|
||||||
'value' => template::ico('help'),
|
|
||||||
'help' => 'Consulter l\'aide en ligne'
|
|
||||||
]); */?>
|
|
||||||
</div>
|
|
||||||
<div class="col2 offset8">
|
|
||||||
<?php echo template::submit('Submit'); ?>
|
<?php echo template::submit('Submit'); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<?php echo template::button('configLocaleButton', [
|
<?php echo template::button('configLocaleButton', [
|
||||||
'value' => 'Identité - Étiquettes',
|
'value' => 'Identité - Étiquettes',
|
||||||
'class' => 'buttonTab'
|
'class' => 'buttonTab'
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::button('configSetupButton', [
|
<?php echo template::button('configSetupButton', [
|
||||||
'value' => 'Configuration - Outils',
|
'value' => 'Configuration',
|
||||||
'class' => 'buttonTab'
|
'class' => 'buttonTab',
|
||||||
|
//'href' => helper::baseUrl() . 'config/register/setup'
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::button('configSocialButton', [
|
<?php echo template::button('configSocialButton', [
|
||||||
'value' => 'Réseaux sociaux',
|
'value' => 'Référencement',
|
||||||
'class' => 'buttonTab'
|
'class' => 'buttonTab',
|
||||||
|
//'href' => helper::baseUrl() . 'config/register/social'
|
||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
<?php echo template::button('configConnectButton', [
|
<?php echo template::button('configConnectButton', [
|
||||||
'value' => 'Sécurité',
|
'value' => 'Connexion',
|
||||||
'class' => 'buttonTab'
|
'class' => 'buttonTab',
|
||||||
|
//'href' => helper::baseUrl() . 'config/register/connect'
|
||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
<?php echo template::button('configNetworkButton', [
|
<?php echo template::button('configNetworkButton', [
|
||||||
'value' => 'Réseau',
|
'value' => 'Réseau',
|
||||||
'class' => 'buttonTab'
|
'class' => 'buttonTab',
|
||||||
|
//'href' => helper::baseUrl() . 'config/register/network'
|
||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<?php include('core/module/config/view/locale/locale.php') ?>
|
<?php include('core/module/config/view/locale/locale.php') ?>
|
||||||
<?php include('core/module/config/view/setup/setup.php') ?>
|
<?php include('core/module/config/view/setup/setup.php') ?>
|
||||||
|
@ -669,17 +669,12 @@ class course extends common
|
|||||||
// Liste des pages contenues dans cet espace et exclure les barres et les pages masquées
|
// Liste des pages contenues dans cet espace et exclure les barres et les pages masquées
|
||||||
$sumPages = 0;
|
$sumPages = 0;
|
||||||
$pages = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/page.json'), true);
|
$pages = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/page.json'), true);
|
||||||
$pages = $pages['page'];
|
$sumPages = $this->countPages($pages['page']);
|
||||||
foreach ($pages as $pageId => $pageData) {
|
|
||||||
if ($pageData['position'] > 0) {
|
|
||||||
$sumPages++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Liste des inscrits dans le contenu sélectionné.
|
// Liste des inscrits dans le contenu sélectionné.
|
||||||
$users = $this->getData(['enrolment', $courseId]);
|
$users = $this->getData(['enrolment', $courseId]);
|
||||||
|
|
||||||
|
// Obtient les statistiques de l'ensemble de la cohorte
|
||||||
$reports = $this->getReport($courseId);
|
$reports = $this->getReport($courseId);
|
||||||
|
|
||||||
if (is_array($users)) {
|
if (is_array($users)) {
|
||||||
@ -798,9 +793,11 @@ class course extends common
|
|||||||
$this->getData(['user', $keyPost]) !== null
|
$this->getData(['user', $keyPost]) !== null
|
||||||
&& $this->getData(['enrolment', $courseId, $keyPost]) === null
|
&& $this->getData(['enrolment', $courseId, $keyPost]) === null
|
||||||
) {
|
) {
|
||||||
$this->setData(['enrolment', $courseId, $keyPost, 'history', array()]);
|
$this->setData(['enrolment', $courseId, $keyPost, 'history', array()], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Sauvegarde la base manuellement
|
||||||
|
$this->saveDB('enrolment');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Liste des groupes et des profils
|
// Liste des groupes et des profils
|
||||||
@ -1154,11 +1151,6 @@ class course extends common
|
|||||||
? helper::baseUrl() . $this->getData(['enrolment', $courseId, $userId, 'lastPageView'])
|
? helper::baseUrl() . $this->getData(['enrolment', $courseId, $userId, 'lastPageView'])
|
||||||
: helper::baseUrl();
|
: helper::baseUrl();
|
||||||
|
|
||||||
/*
|
|
||||||
$essage = $this->getData(['enrolment', $courseId, $userId, 'datePageView'])
|
|
||||||
? $this->getData(['enrolment', $courseId, $userId, 'datePageView'])
|
|
||||||
: '';
|
|
||||||
*/
|
|
||||||
if ($this->getData(['course', $courseId, 'access']) === self::COURSE_ACCESS_DATE) {
|
if ($this->getData(['course', $courseId, 'access']) === self::COURSE_ACCESS_DATE) {
|
||||||
$to = helper::dateUTF8('%d %B %Y', $this->getData(['course', $courseId, 'closingDate']), self::$i18nUI) . helper::translate(' à ') . helper::dateUTF8('%H:%M', $this->getData(['course', $courseId, 'closingDate']), self::$i18nUI);
|
$to = helper::dateUTF8('%d %B %Y', $this->getData(['course', $courseId, 'closingDate']), self::$i18nUI) . helper::translate(' à ') . helper::dateUTF8('%H:%M', $this->getData(['course', $courseId, 'closingDate']), self::$i18nUI);
|
||||||
$message .= sprintf(helper::translate('Ce contenu ferme le %s'), $to);
|
$message .= sprintf(helper::translate('Ce contenu ferme le %s'), $to);
|
||||||
@ -1390,7 +1382,7 @@ class course extends common
|
|||||||
if (!empty($userValue['history'])) {
|
if (!empty($userValue['history'])) {
|
||||||
$maxTime = max($userValue['history']);
|
$maxTime = max($userValue['history']);
|
||||||
$lastPageId = array_search($maxTime, $userValue['history']);
|
$lastPageId = array_search($maxTime, $userValue['history']);
|
||||||
$this->setData(['enrolment', $courseId, $userId, 'lastPageView', $lastPageId]);
|
$this->setData(['enrolment', $courseId, $userId, 'lastPageView', $lastPageId], false);
|
||||||
$this->setData(['enrolment', $courseId, $userId, 'datePageView', $maxTime]);
|
$this->setData(['enrolment', $courseId, $userId, 'datePageView', $maxTime]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2027,7 +2019,7 @@ class course extends common
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Autorise l'accès à un contenu
|
* Autorise l'accès à un contenu
|
||||||
* @param @return bool le user a le droit d'entrée dans le contenu
|
* @return bool le user a le droit d'entrée dans le contenu
|
||||||
* @param string $courseId identifiant du contenu sollicité
|
* @param string $courseId identifiant du contenu sollicité
|
||||||
*/
|
*/
|
||||||
public function courseIsAvailable($courseId)
|
public function courseIsAvailable($courseId)
|
||||||
@ -2038,7 +2030,7 @@ class course extends common
|
|||||||
}
|
}
|
||||||
// Si un utilisateur connecté est admin ou auteur, c'est autorisé
|
// Si un utilisateur connecté est admin ou auteur, c'est autorisé
|
||||||
if (
|
if (
|
||||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') &&
|
$this->isConnected() === true &&
|
||||||
($this->getUser('group') === self::GROUP_ADMIN ||
|
($this->getUser('group') === self::GROUP_ADMIN ||
|
||||||
$this->getUser('id') === $this->getData(['course', $courseId, 'author']))
|
$this->getUser('id') === $this->getData(['course', $courseId, 'author']))
|
||||||
) {
|
) {
|
||||||
@ -2055,17 +2047,23 @@ class course extends common
|
|||||||
time() <= $this->getData(['course', $courseId, 'closingDate'])
|
time() <= $this->getData(['course', $courseId, 'closingDate'])
|
||||||
);
|
);
|
||||||
case self::COURSE_ACCESS_CLOSE:
|
case self::COURSE_ACCESS_CLOSE:
|
||||||
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Compte les pages d'un espace
|
||||||
|
* @param mixed $array Tableau des pages de l'espace
|
||||||
|
* @return int Nombre de pages
|
||||||
|
*/
|
||||||
private function countPages($array)
|
private function countPages($array)
|
||||||
{
|
{
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($array as $key => $value) {
|
foreach ($array as $pageId => $pageData) {
|
||||||
$count++; // Incrémente le compteur pour chaque clé associative trouvée
|
if ($pageData['position'] > 0) {
|
||||||
if (is_array($value)) {
|
$count++;
|
||||||
$count += $this->countPages($value); // Appelle récursivement la fonction si la valeur est un tableau
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $count;
|
return $count;
|
||||||
@ -2085,7 +2083,7 @@ class course extends common
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Autorise l'accès à un contenu
|
* Autorise l'accès à un contenu
|
||||||
* @param @return bool le user a le droit d'entrée dans le contenu
|
* @return bool le user a le droit d'entrée dans le contenu
|
||||||
* @param string $userId identifiant de l'utilisateur
|
* @param string $userId identifiant de l'utilisateur
|
||||||
* @param string $courseId identifiant du contenu sollicité
|
* @param string $courseId identifiant du contenu sollicité
|
||||||
*/
|
*/
|
||||||
@ -2118,7 +2116,7 @@ class course extends common
|
|||||||
/**
|
/**
|
||||||
* Lit le contenu des fichiers de traces au format CS et renvoie un tableau associatif
|
* Lit le contenu des fichiers de traces au format CS et renvoie un tableau associatif
|
||||||
*/
|
*/
|
||||||
private function getReport($courseId, $userId = null)
|
public function getReport($courseId, $userId = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
@ -2134,14 +2132,19 @@ class course extends common
|
|||||||
$pageId = $line[1];
|
$pageId = $line[1];
|
||||||
$timestamp = $line[2];
|
$timestamp = $line[2];
|
||||||
// Filtre userId
|
// Filtre userId
|
||||||
// if (!is_null($userId) && $name === $userId) {
|
if (
|
||||||
|
is_null($userId) === false
|
||||||
|
&& $name !== $userId
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Initialiser le tableau si nécessaire
|
// Initialiser le tableau si nécessaire
|
||||||
if (!isset($data[$name][$pageId])) {
|
if (!isset($data[$name][$pageId])) {
|
||||||
$data[$name][$pageId] = array();
|
$data[$name][$pageId] = array();
|
||||||
}
|
}
|
||||||
// Ajouter le timestamp
|
// Ajouter le timestamp
|
||||||
$data[$name][$pageId][] = $timestamp;
|
$data[$name][$pageId][] = $timestamp;
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fermer le fichier
|
// Fermer le fichier
|
||||||
@ -2158,6 +2161,4 @@ class course extends common
|
|||||||
// Afficher le JSON;
|
// Afficher le JSON;
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -8,7 +8,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col1 offset10">
|
<div class="col1 offset10">
|
||||||
<?php echo template::button('userDeleteAll', [
|
<?php echo template::button('userDeleteAll', [
|
||||||
'href' => helper::baseUrl() . 'course/userHistoryExport/' . $this->getUrl(2) . '/' . $this->getUrl(3),
|
'href' => helper::baseUrl() . 'course/userReportExport/' . $this->getUrl(2) . '/' . $this->getUrl(3),
|
||||||
'value' => template::ico('download'),
|
'value' => template::ico('download'),
|
||||||
'help' => 'Exporter',
|
'help' => 'Exporter',
|
||||||
]) ?>
|
]) ?>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col1 offset8">
|
<div class="col1 offset8">
|
||||||
<?php echo template::button('userDeleteAll', [
|
<?php echo template::button('userDeleteAll', [
|
||||||
'href' => helper::baseUrl() . 'course/usersHistoryExport/' . $this->getUrl(2),
|
'href' => helper::baseUrl() . 'course/usersReportExport/' . $this->getUrl(2),
|
||||||
'value' => template::ico('download'),
|
'value' => template::ico('download'),
|
||||||
'help' => 'Exporter',
|
'help' => 'Exporter',
|
||||||
]) ?>
|
]) ?>
|
||||||
|
@ -158,9 +158,9 @@ class install extends common
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Sauvegarder la configuration du Proxy
|
// Sauvegarder la configuration du Proxy
|
||||||
$this->setData(['config', 'proxyType', $this->getInput('installProxyType')]);
|
$this->setData(['config', 'proxyType', $this->getInput('installProxyType')], false);
|
||||||
$this->setData(['config', 'proxyUrl', $this->getInput('installProxyUrl')]);
|
$this->setData(['config', 'proxyUrl', $this->getInput('installProxyUrl')], false);
|
||||||
$this->setData(['config', 'proxyPort', $this->getInput('installProxyPort', helper::FILTER_INT)]);
|
$this->setData(['config', 'proxyPort', $this->getInput('installProxyPort', helper::FILTER_INT)], false);
|
||||||
|
|
||||||
// Images exemples livrées dans tous les cas
|
// Images exemples livrées dans tous les cas
|
||||||
try {
|
try {
|
||||||
@ -203,7 +203,7 @@ class install extends common
|
|||||||
$this->copyDir('core/module/install/ressource/i18n', self::I18N_DIR);
|
$this->copyDir('core/module/install/ressource/i18n', self::I18N_DIR);
|
||||||
|
|
||||||
// Fixe l'adresse from pour les envois d'email
|
// Fixe l'adresse from pour les envois d'email
|
||||||
$this->setData(['config', 'smtp', 'from', 'no-reply@' . str_replace('www.', '', $_SERVER['HTTP_HOST'])]);
|
$this->setData(['config', 'smtp', 'from', 'no-reply@' . str_replace('www.', '', $_SERVER['HTTP_HOST'])], false);
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
@ -212,9 +212,10 @@ class install extends common
|
|||||||
'state' => true
|
'state' => true
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
// Force la sauvegarde
|
||||||
|
$this->saveDB('config');
|
||||||
|
|
||||||
// Affichage du formulaire
|
// Affichage du formulaire
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'display' => self::DISPLAY_LAYOUT_LIGHT,
|
'display' => self::DISPLAY_LAYOUT_LIGHT,
|
||||||
|
@ -246,7 +246,7 @@ class init extends common
|
|||||||
'manage' => false,
|
'manage' => false,
|
||||||
'users' => false,
|
'users' => false,
|
||||||
'userHistory' => false,
|
'userHistory' => false,
|
||||||
'userHistoryExport' => false,
|
'userReportExport' => false,
|
||||||
'usersAdd' => false,
|
'usersAdd' => false,
|
||||||
'userDelete' => false,
|
'userDelete' => false,
|
||||||
'usersDelete' => false,
|
'usersDelete' => false,
|
||||||
@ -343,7 +343,7 @@ class init extends common
|
|||||||
'manage' => false,
|
'manage' => false,
|
||||||
'users' => false,
|
'users' => false,
|
||||||
'userHistory' => false,
|
'userHistory' => false,
|
||||||
'userHistoryExport' => false,
|
'userReportExport' => false,
|
||||||
'usersAdd' => false,
|
'usersAdd' => false,
|
||||||
'userDelete' => false,
|
'userDelete' => false,
|
||||||
'usersDelete' => false,
|
'usersDelete' => false,
|
||||||
@ -445,7 +445,7 @@ class init extends common
|
|||||||
'manage' => true,
|
'manage' => true,
|
||||||
'users' => true,
|
'users' => true,
|
||||||
'userHistory' => true,
|
'userHistory' => true,
|
||||||
'userHistoryExport' => true,
|
'userReportExport' => true,
|
||||||
'usersAdd' => true,
|
'usersAdd' => true,
|
||||||
'userDelete' => false,
|
'userDelete' => false,
|
||||||
'usersDelete' => false,
|
'usersDelete' => false,
|
||||||
@ -543,7 +543,7 @@ class init extends common
|
|||||||
'manage' => true,
|
'manage' => true,
|
||||||
'users' => true,
|
'users' => true,
|
||||||
'userHistory' => true,
|
'userHistory' => true,
|
||||||
'userHistoryExport' => true,
|
'userReportExport' => true,
|
||||||
'usersAdd' => true,
|
'usersAdd' => true,
|
||||||
'userDelete' => true,
|
'userDelete' => true,
|
||||||
'usersDelete' => true,
|
'usersDelete' => true,
|
||||||
|
@ -23,7 +23,8 @@ class page extends common
|
|||||||
'edit' => self::GROUP_EDITOR,
|
'edit' => self::GROUP_EDITOR,
|
||||||
'duplicate' => self::GROUP_EDITOR,
|
'duplicate' => self::GROUP_EDITOR,
|
||||||
'jsEditor' => self::GROUP_EDITOR,
|
'jsEditor' => self::GROUP_EDITOR,
|
||||||
'cssEditor' => self::GROUP_EDITOR
|
'cssEditor' => self::GROUP_EDITOR,
|
||||||
|
'register' => self::GROUP_EDITOR,
|
||||||
];
|
];
|
||||||
public static $pagesNoParentId = [
|
public static $pagesNoParentId = [
|
||||||
'' => 'Aucune'
|
'' => 'Aucune'
|
||||||
@ -118,14 +119,16 @@ class page extends common
|
|||||||
$page
|
$page
|
||||||
]);
|
]);
|
||||||
// Ecriture
|
// Ecriture
|
||||||
$this->setData(['page', $pageId, $data]);
|
$this->setData(['page', $pageId, $data], false);
|
||||||
$notification = helper::translate('Page dupliquée');
|
$notification = helper::translate('Page dupliquée');
|
||||||
// Duplication du module présent
|
// Duplication du module présent
|
||||||
if ($this->getData(['page', $page, 'moduleId'])) {
|
if ($this->getData(['page', $page, 'moduleId'])) {
|
||||||
$data = $this->getData(['module', $page]);
|
$data = $this->getData(['module', $page]);
|
||||||
$this->setData(['module', $pageId, $data]);
|
$this->setData(['module', $pageId, $data], false);
|
||||||
$notification = helper::translate('Page et module dupliqués');
|
$notification = helper::translate('Page et module dupliqués');
|
||||||
}
|
}
|
||||||
|
// Force la sauvegarde
|
||||||
|
$this->saveDB('page');
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
@ -390,11 +393,11 @@ class page extends common
|
|||||||
$pageId = helper::increment($pageId, self::$moduleIds);
|
$pageId = helper::increment($pageId, self::$moduleIds);
|
||||||
// Met à jour les enfants
|
// Met à jour les enfants
|
||||||
foreach ($this->getHierarchy($this->getUrl(2), null) as $childrenPageId) {
|
foreach ($this->getHierarchy($this->getUrl(2), null) as $childrenPageId) {
|
||||||
$this->setData(['page', $childrenPageId, 'parentPageId', $pageId]);
|
$this->setData(['page', $childrenPageId, 'parentPageId', $pageId], false);
|
||||||
}
|
}
|
||||||
// Change l'id de page dans les données des modules
|
// Change l'id de page dans les données des modules
|
||||||
if ($this->getData(['module', $this->getUrl(2)]) !== null) {
|
if ($this->getData(['module', $this->getUrl(2)]) !== null) {
|
||||||
$this->setData(['module', $pageId, $this->getData(['module', $this->getUrl(2)])]);
|
$this->setData(['module', $pageId, $this->getData(['module', $this->getUrl(2)])], false);
|
||||||
$this->deleteData(['module', $this->getUrl(2)]);
|
$this->deleteData(['module', $this->getUrl(2)]);
|
||||||
// Renommer le dossier du module
|
// Renommer le dossier du module
|
||||||
$moduleId = $this->getData(['page', $this->getUrl(2), 'moduleId']);
|
$moduleId = $this->getData(['page', $this->getUrl(2), 'moduleId']);
|
||||||
@ -405,8 +408,10 @@ class page extends common
|
|||||||
copy($modulesData[$moduleId]['dataDirectory'] . $this->getUrl(2), $modulesData[$moduleId]['dataDirectory'] . $pageId);
|
copy($modulesData[$moduleId]['dataDirectory'] . $this->getUrl(2), $modulesData[$moduleId]['dataDirectory'] . $pageId);
|
||||||
$this->deleteDir($modulesData[$moduleId]['dataDirectory'] . $this->getUrl(2));
|
$this->deleteDir($modulesData[$moduleId]['dataDirectory'] . $this->getUrl(2));
|
||||||
// Mettre à jour le nom de la feuille de style
|
// Mettre à jour le nom de la feuille de style
|
||||||
$this->setData(['module', $pageId, 'theme', 'style', $modulesData[$moduleId]['dataDirectory'] . $pageId]);
|
$this->setData(['module', $pageId, 'theme', 'style', $modulesData[$moduleId]['dataDirectory'] . $pageId], false);
|
||||||
}
|
}
|
||||||
|
// Sauvegarde la base manuellement
|
||||||
|
$this->saveDB('module');
|
||||||
}
|
}
|
||||||
// Met à jour les historiques des utilisateurs
|
// Met à jour les historiques des utilisateurs
|
||||||
foreach ($this->getData(['enrolment', self::$siteContent]) as $userId => $userData) {
|
foreach ($this->getData(['enrolment', self::$siteContent]) as $userId => $userData) {
|
||||||
@ -417,14 +422,17 @@ class page extends common
|
|||||||
) {
|
) {
|
||||||
// Remplacer l'ancienne ID par la nouvelle
|
// Remplacer l'ancienne ID par la nouvelle
|
||||||
$datas = $this->getData(['enrolment', self::$siteContent, $userId, 'history', $this->getUrl(2)]);
|
$datas = $this->getData(['enrolment', self::$siteContent, $userId, 'history', $this->getUrl(2)]);
|
||||||
$this->setData(['enrolment', self::$siteContent, $userId, 'history', $pageId, $datas]);
|
$this->setData(['enrolment', self::$siteContent, $userId, 'history', $pageId, $datas], false);
|
||||||
$this->deleteData(['enrolment', self::$siteContent, $userId, 'history', $this->getUrl(2)]);
|
$this->deleteData(['enrolment', self::$siteContent, $userId, 'history', $this->getUrl(2)]);
|
||||||
}
|
}
|
||||||
// Mettre à jour la dernière page vue si nécessaire
|
// Mettre à jour la dernière page vue si nécessaire
|
||||||
if ($this->getData(['enrolment', self::$siteContent, $userId, 'lastPageView']) === $this->getUrl(2)) {
|
if ($this->getData(['enrolment', self::$siteContent, $userId, 'lastPageView']) === $this->getUrl(2)) {
|
||||||
$this->setData(['enrolment', self::$siteContent, $userId, 'lastPageView', $pageId]);
|
$this->setData(['enrolment', self::$siteContent, $userId, 'lastPageView', $pageId], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Sauvegarde la base manuellement
|
||||||
|
$this->saveDB('enrolment');
|
||||||
|
|
||||||
// Met à jour la homePage si nécessaire
|
// Met à jour la homePage si nécessaire
|
||||||
if ($this->getUrl(2) === $this->getData(['course', self::$siteContent, 'homePageId'])) {
|
if ($this->getUrl(2) === $this->getData(['course', self::$siteContent, 'homePageId'])) {
|
||||||
$this->setData(['course', self::$siteContent, 'homePageId', $pageId]);
|
$this->setData(['course', self::$siteContent, 'homePageId', $pageId]);
|
||||||
@ -432,7 +440,7 @@ class page extends common
|
|||||||
|
|
||||||
// Si la page correspond à la page d'accueil, change l'id dans la configuration du site
|
// Si la page correspond à la page d'accueil, change l'id dans la configuration du site
|
||||||
if ($this->getData(['config', 'homePageId']) === $this->getUrl(2)) {
|
if ($this->getData(['config', 'homePageId']) === $this->getUrl(2)) {
|
||||||
$this->setData(['config', 'homePageId', $pageId]);
|
$this->setData(['config', 'homePageId', $pageId], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Supprime les données du module en cas de changement de module
|
// Supprime les données du module en cas de changement de module
|
||||||
@ -448,20 +456,22 @@ class page extends common
|
|||||||
}
|
}
|
||||||
// Traitement des pages spéciales affectées dans la config :
|
// Traitement des pages spéciales affectées dans la config :
|
||||||
if ($this->getUrl(2) === $this->getData(['config', 'legalPageId'])) {
|
if ($this->getUrl(2) === $this->getData(['config', 'legalPageId'])) {
|
||||||
$this->setData(['config', 'legalPageId', $pageId]);
|
$this->setData(['config', 'legalPageId', $pageId], false);
|
||||||
}
|
}
|
||||||
if ($this->getUrl(2) === $this->getData(['config', 'searchPageId'])) {
|
if ($this->getUrl(2) === $this->getData(['config', 'searchPageId'])) {
|
||||||
$this->setData(['config', 'searchPageId', $pageId]);
|
$this->setData(['config', 'searchPageId', $pageId], false);
|
||||||
}
|
}
|
||||||
if ($this->getUrl(2) === $this->getData(['config', 'page404'])) {
|
if ($this->getUrl(2) === $this->getData(['config', 'page404'])) {
|
||||||
$this->setData(['config', 'page404', $pageId]);
|
$this->setData(['config', 'page404', $pageId], false);
|
||||||
}
|
}
|
||||||
if ($this->getUrl(2) === $this->getData(['config', 'page403'])) {
|
if ($this->getUrl(2) === $this->getData(['config', 'page403'])) {
|
||||||
$this->setData(['config', 'page403', $pageId]);
|
$this->setData(['config', 'page403', $pageId], false);
|
||||||
}
|
}
|
||||||
if ($this->getUrl(2) === $this->getData(['config', 'page302'])) {
|
if ($this->getUrl(2) === $this->getData(['config', 'page302'])) {
|
||||||
$this->setData(['config', 'page302', $pageId]);
|
$this->setData(['config', 'page302', $pageId], false);
|
||||||
}
|
}
|
||||||
|
// Sauvegarde la base manuellement
|
||||||
|
$this->saveDB(module: 'config');
|
||||||
// Si la page est une page enfant, actualise les positions des autres enfants du parent, sinon actualise les pages sans parents
|
// Si la page est une page enfant, actualise les positions des autres enfants du parent, sinon actualise les pages sans parents
|
||||||
$lastPosition = 1;
|
$lastPosition = 1;
|
||||||
$hierarchy = $this->getInput('pageEditParentPageId') ? $this->getHierarchy($this->getInput('pageEditParentPageId')) : array_keys($this->getHierarchy());
|
$hierarchy = $this->getInput('pageEditParentPageId') ? $this->getHierarchy($this->getInput('pageEditParentPageId')) : array_keys($this->getHierarchy());
|
||||||
@ -480,11 +490,12 @@ class page extends common
|
|||||||
$lastPosition++;
|
$lastPosition++;
|
||||||
}
|
}
|
||||||
// Change la position
|
// Change la position
|
||||||
$this->setData(['page', $hierarchyPageId, 'position', $lastPosition]);
|
$this->setData(['page', $hierarchyPageId, 'position', $lastPosition], false);
|
||||||
// Incrémente pour la prochaine position
|
// Incrémente pour la prochaine position
|
||||||
$lastPosition++;
|
$lastPosition++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->getinput('pageEditBlock') !== 'bar') {
|
if ($this->getinput('pageEditBlock') !== 'bar') {
|
||||||
$barLeft = $this->getinput('pageEditBarLeft');
|
$barLeft = $this->getinput('pageEditBarLeft');
|
||||||
$barRight = $this->getinput('pageEditBarRight');
|
$barRight = $this->getinput('pageEditBarRight');
|
||||||
@ -505,7 +516,7 @@ class page extends common
|
|||||||
) {
|
) {
|
||||||
foreach ($this->getHierarchy($pageId) as $parentId => $childId) {
|
foreach ($this->getHierarchy($pageId) as $parentId => $childId) {
|
||||||
if ($this->getData(['page', $childId, 'parentPageId']) === $pageId) {
|
if ($this->getData(['page', $childId, 'parentPageId']) === $pageId) {
|
||||||
$this->setData(['page', $childId, 'position', 0]);
|
$this->setData(['page', $childId, 'position', 0], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -514,17 +525,17 @@ class page extends common
|
|||||||
if ($this->getinput('pageEditBlock') === 'bar') {
|
if ($this->getinput('pageEditBlock') === 'bar') {
|
||||||
foreach ($this->getHierarchy() as $eachPageId => $parentId) {
|
foreach ($this->getHierarchy() as $eachPageId => $parentId) {
|
||||||
if ($this->getData(['page', $eachPageId, 'barRight']) === $this->getUrl(2)) {
|
if ($this->getData(['page', $eachPageId, 'barRight']) === $this->getUrl(2)) {
|
||||||
$this->setData(['page', $eachPageId, 'barRight', $pageId]);
|
$this->setData(['page', $eachPageId, 'barRight', $pageId], false);
|
||||||
}
|
}
|
||||||
if ($this->getData(['page', $eachPageId, 'barLeft']) === $this->getUrl(2)) {
|
if ($this->getData(['page', $eachPageId, 'barLeft']) === $this->getUrl(2)) {
|
||||||
$this->setData(['page', $eachPageId, 'barLeft', $pageId]);
|
$this->setData(['page', $eachPageId, 'barLeft', $pageId], false);
|
||||||
}
|
}
|
||||||
foreach ($parentId as $childId) {
|
foreach ($parentId as $childId) {
|
||||||
if ($this->getData(['page', $childId, 'barRight']) === $this->getUrl(2)) {
|
if ($this->getData(['page', $childId, 'barRight']) === $this->getUrl(2)) {
|
||||||
$this->setData(['page', $childId, 'barRight', $pageId]);
|
$this->setData(['page', $childId, 'barRight', $pageId], false);
|
||||||
}
|
}
|
||||||
if ($this->getData(['page', $childId, 'barLeft']) === $this->getUrl(2)) {
|
if ($this->getData(['page', $childId, 'barLeft']) === $this->getUrl(2)) {
|
||||||
$this->setData(['page', $childId, 'barLeft', $pageId]);
|
$this->setData(['page', $childId, 'barLeft', $pageId], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -740,10 +751,31 @@ class page extends common
|
|||||||
{
|
{
|
||||||
$p = $this->getData(['page']);
|
$p = $this->getData(['page']);
|
||||||
$d = array_map(function ($d) {
|
$d = array_map(function ($d) {
|
||||||
unset ($d["css"], $d["js"]);
|
unset($d["css"], $d["js"]);
|
||||||
return $d;
|
return $d;
|
||||||
}, $p);
|
}, $p);
|
||||||
return json_encode($d);
|
return json_encode($d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stocke la variable dans les paramètres de l'utilisateur pour activer la tab à sa prochaine visite
|
||||||
|
* @return never
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
$this->setData([
|
||||||
|
'user',
|
||||||
|
$this->getUser('id'),
|
||||||
|
'view',
|
||||||
|
[
|
||||||
|
'page' => $this->getUrl(2),
|
||||||
|
'config' => $this->getData(['user', $this->getUser('id'), 'view', 'config']),
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'redirect' => helper::baseUrl() . 'page/edit/' . $this->getUrl(3) . '/' . self::$siteContent,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -67,16 +67,18 @@ $( document ).ready(function() {
|
|||||||
/**
|
/**
|
||||||
* Sélection des onglets
|
* Sélection des onglets
|
||||||
*/
|
*/
|
||||||
var pageLayout = getCookie("pageLayout");
|
var pageLayout = "<?php echo $this->getData(['user', $this->getUser('id'), 'view', 'page']);?>";
|
||||||
if (pageLayout == null) {
|
// Non défini, valeur par défaut
|
||||||
pageLayout = "content";
|
if (pageLayout == "") {
|
||||||
setCookie("pageLayout", "content");
|
pageLayout = "content";
|
||||||
}
|
}
|
||||||
|
// Tout cacher
|
||||||
$("#pageEditContentContainer").hide();
|
$("#pageEditContentContainer").hide();
|
||||||
$("#pageEditExtensionContainer").hide();
|
$("#pageEditExtensionContainer").hide();
|
||||||
$("#pageEditPositionContainer").hide();
|
$("#pageEditPositionContainer").hide();
|
||||||
$("#pageEditLayoutContainer").hide();
|
$("#pageEditLayoutContainer").hide();
|
||||||
$("#pageEditPermissionContainer").hide();
|
$("#pageEditPermissionContainer").hide();
|
||||||
|
// Afficher la bonne tab
|
||||||
$("#pageEdit" + capitalizeFirstLetter(pageLayout) + "Container").show();
|
$("#pageEdit" + capitalizeFirstLetter(pageLayout) + "Container").show();
|
||||||
$("#pageEdit" + capitalizeFirstLetter(pageLayout) + "Button").addClass("activeButton");
|
$("#pageEdit" + capitalizeFirstLetter(pageLayout) + "Button").addClass("activeButton");
|
||||||
|
|
||||||
@ -295,7 +297,6 @@ $( document ).ready(function() {
|
|||||||
$("#PageEditPositionButton").removeClass("activeButton");
|
$("#PageEditPositionButton").removeClass("activeButton");
|
||||||
$("#pageEditLayoutButton").removeClass("activeButton");
|
$("#pageEditLayoutButton").removeClass("activeButton");
|
||||||
$("#pageEditPermissionButton").removeClass("activeButton");
|
$("#pageEditPermissionButton").removeClass("activeButton");
|
||||||
setCookie("pageLayout", "content");
|
|
||||||
});
|
});
|
||||||
$("#pageEditExtensionButton").on("click", function () {
|
$("#pageEditExtensionButton").on("click", function () {
|
||||||
$("#pageEditContentContainer").hide();
|
$("#pageEditContentContainer").hide();
|
||||||
@ -308,7 +309,6 @@ $( document ).ready(function() {
|
|||||||
$("#PageEditPositionButton").removeClass("activeButton");
|
$("#PageEditPositionButton").removeClass("activeButton");
|
||||||
$("#pageEditLayoutButton").removeClass("activeButton");
|
$("#pageEditLayoutButton").removeClass("activeButton");
|
||||||
$("#pageEditPermissionButton").removeClass("activeButton");
|
$("#pageEditPermissionButton").removeClass("activeButton");
|
||||||
setCookie("pageLayout", "extension");
|
|
||||||
});
|
});
|
||||||
$("#PageEditPositionButton").on("click", function () {
|
$("#PageEditPositionButton").on("click", function () {
|
||||||
$("#pageEditContentContainer").hide();
|
$("#pageEditContentContainer").hide();
|
||||||
@ -321,7 +321,6 @@ $( document ).ready(function() {
|
|||||||
$("#PageEditPositionButton").addClass("activeButton");
|
$("#PageEditPositionButton").addClass("activeButton");
|
||||||
$("#pageEditLayoutButton").removeClass("activeButton");
|
$("#pageEditLayoutButton").removeClass("activeButton");
|
||||||
$("#pageEditPermissionButton").removeClass("activeButton");
|
$("#pageEditPermissionButton").removeClass("activeButton");
|
||||||
setCookie("pageLayout", "position");
|
|
||||||
});
|
});
|
||||||
$("#pageEditLayoutButton").on("click", function () {
|
$("#pageEditLayoutButton").on("click", function () {
|
||||||
$("#pageEditContentContainer").hide();
|
$("#pageEditContentContainer").hide();
|
||||||
@ -334,7 +333,6 @@ $( document ).ready(function() {
|
|||||||
$("#PageEditPositionButton").removeClass("activeButton");
|
$("#PageEditPositionButton").removeClass("activeButton");
|
||||||
$("#pageEditLayoutButton").addClass("activeButton");
|
$("#pageEditLayoutButton").addClass("activeButton");
|
||||||
$("#pageEditPermissionButton").removeClass("activeButton");
|
$("#pageEditPermissionButton").removeClass("activeButton");
|
||||||
setCookie("pageLayout", "layout");
|
|
||||||
});
|
});
|
||||||
$("#pageEditPermissionButton").on("click", function () {
|
$("#pageEditPermissionButton").on("click", function () {
|
||||||
$("#pageEditContentContainer").hide();
|
$("#pageEditContentContainer").hide();
|
||||||
@ -347,7 +345,6 @@ $( document ).ready(function() {
|
|||||||
$("#pageEditPositionButton").removeClass("activeButton");
|
$("#pageEditPositionButton").removeClass("activeButton");
|
||||||
$("#pageEditLayoutButton").removeClass("activeButton");
|
$("#pageEditLayoutButton").removeClass("activeButton");
|
||||||
$("#pageEditPermissionButton").addClass("activeButton");
|
$("#pageEditPermissionButton").addClass("activeButton");
|
||||||
setCookie("pageLayout", "permission");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -722,30 +719,6 @@ function buildPagesList(extraPosition) {
|
|||||||
positionDOM.val(positionSelected);
|
positionDOM.val(positionSelected);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Cookies
|
|
||||||
*/
|
|
||||||
function setCookie(name, value, days) {
|
|
||||||
var expires = "";
|
|
||||||
if (days) {
|
|
||||||
var date = new Date();
|
|
||||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
||||||
expires = "; expires=" + date.toUTCString();
|
|
||||||
}
|
|
||||||
document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCookie(name) {
|
|
||||||
var nameEQ = name + "=";
|
|
||||||
var ca = document.cookie.split(';');
|
|
||||||
for (var i = 0; i < ca.length; i++) {
|
|
||||||
var c = ca[i];
|
|
||||||
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
||||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define function to capitalize the first letter of a string
|
// Define function to capitalize the first letter of a string
|
||||||
function capitalizeFirstLetter(string) {
|
function capitalizeFirstLetter(string) {
|
||||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?php echo template::formOpen('pageEditForm'); ?>
|
<?php echo template::formOpen('pageEditForm'); ?>
|
||||||
|
<!-- Variable transmise à TinyMCE -->
|
||||||
|
<div id="zwii_site_content" data-variable="<?php echo htmlspecialchars(isset($_SESSION['ZWII_SITE_CONTENT']) ? $_SESSION['ZWII_SITE_CONTENT'] : 'home'); ?>"></div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col1">
|
<div class="col1">
|
||||||
<?php echo template::button('configModulesBack', [
|
<?php echo template::button('configModulesBack', [
|
||||||
@ -28,26 +30,32 @@
|
|||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<?php echo template::button('pageEditContentButton', [
|
<?php echo template::button('pageEditContentButton', [
|
||||||
'value' => 'Contenu',
|
'value' => 'Contenu',
|
||||||
'class' => 'buttonTab'
|
'class' => 'buttonTab',
|
||||||
|
'href' => helper::baseUrl() . 'page/register/content/' . $this->geturl(2)
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::button('PageEditPositionButton', [
|
<?php echo template::button('pageEditPositionButton', [
|
||||||
'value' => 'Menu',
|
'value' => 'Menu',
|
||||||
'class' => 'buttonTab'
|
'class' => 'buttonTab',
|
||||||
|
'href' => helper::baseUrl() . 'page/register/position/' . $this->geturl(2)
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::button('pageEditExtensionButton', [
|
<?php echo template::button('pageEditExtensionButton', [
|
||||||
'value' => 'Extension',
|
'value' => 'Extension',
|
||||||
'class' => 'buttonTab'
|
'class' => 'buttonTab',
|
||||||
|
'href' => helper::baseUrl() . 'page/register/extension/' . $this->geturl(2)
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::button('pageEditLayoutButton', [
|
<?php echo template::button('pageEditLayoutButton', [
|
||||||
'value' => 'Mise en page',
|
'value' => 'Mise en page',
|
||||||
'class' => 'buttonTab'
|
'class' => 'buttonTab',
|
||||||
|
'href' => helper::baseUrl() . 'page/register/layout/' . $this->geturl(2)
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::button('pageEditPermissionButton', [
|
<?php echo template::button('pageEditPermissionButton', [
|
||||||
'value' => 'Permission',
|
'value' => 'Permission',
|
||||||
'class' => 'buttonTab'
|
'class' => 'buttonTab',
|
||||||
|
'href' => helper::baseUrl() . 'page/register/permission/' . $this->geturl(2)
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class plugin extends common
|
|||||||
'delete' => self::GROUP_ADMIN,
|
'delete' => self::GROUP_ADMIN,
|
||||||
'save' => self::GROUP_ADMIN,
|
'save' => self::GROUP_ADMIN,
|
||||||
'store' => self::GROUP_ADMIN,
|
'store' => self::GROUP_ADMIN,
|
||||||
'item' => self::GROUP_ADMIN,
|
//'item' => self::GROUP_ADMIN,
|
||||||
// détail d'un objet
|
// détail d'un objet
|
||||||
'upload' => self::GROUP_ADMIN,
|
'upload' => self::GROUP_ADMIN,
|
||||||
// Téléverser catalogue
|
// Téléverser catalogue
|
||||||
@ -237,8 +237,8 @@ class plugin extends common
|
|||||||
return ([
|
return ([
|
||||||
'success' => $success,
|
'success' => $success,
|
||||||
'notification' => $success
|
'notification' => $success
|
||||||
? sprintf(helper::translate('Le module %s a été %s'), $module['name'], $t)
|
? sprintf(helper::translate('Le module %s a été %s'), $module['name'], $t)
|
||||||
: helper::translate('Erreur inconnue, le module n\'est pas installé')
|
: helper::translate('Erreur inconnue, le module n\'est pas installé')
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// Supprimer le dossier temporaire
|
// Supprimer le dossier temporaire
|
||||||
@ -391,7 +391,6 @@ class plugin extends common
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => helper::translate('Catalogue de modules'),
|
'title' => helper::translate('Catalogue de modules'),
|
||||||
@ -414,6 +413,16 @@ class plugin extends common
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le contenu du store en ligne
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function getStore()
|
||||||
|
{
|
||||||
|
$store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
||||||
|
return $store;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gestion des modules
|
* Gestion des modules
|
||||||
*/
|
*/
|
||||||
@ -561,6 +570,9 @@ class plugin extends common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Désactive l'icône rouge
|
||||||
|
$this->setData(['core', 'updateModuleAvailable', false]);
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => helper::translate('Gestion des modules'),
|
'title' => helper::translate('Gestion des modules'),
|
||||||
|
@ -507,21 +507,23 @@ class theme extends common
|
|||||||
'featureContent' => $featureContent,
|
'featureContent' => $featureContent,
|
||||||
'featureFiles' => $files
|
'featureFiles' => $files
|
||||||
]
|
]
|
||||||
]);
|
], false);
|
||||||
// Modification de la position du menu selon la position de la bannière
|
// Modification de la position du menu selon la position de la bannière
|
||||||
if ($this->getData(['theme', 'header', 'position']) == 'site') {
|
if ($this->getData(['theme', 'header', 'position']) == 'site') {
|
||||||
$this->setData(['theme', 'menu', 'position', str_replace('body-', 'site-', $this->getData(['theme', 'menu', 'position']))]);
|
$this->setData(['theme', 'menu', 'position', str_replace('body-', 'site-', $this->getData(['theme', 'menu', 'position']))], false);
|
||||||
}
|
}
|
||||||
if ($this->getData(['theme', 'header', 'position']) == 'body') {
|
if ($this->getData(['theme', 'header', 'position']) == 'body') {
|
||||||
$this->setData(['theme', 'menu', 'position', str_replace('site-', 'body-', $this->getData(['theme', 'menu', 'position']))]);
|
$this->setData(['theme', 'menu', 'position', str_replace('site-', 'body-', $this->getData(['theme', 'menu', 'position']))], false);
|
||||||
}
|
}
|
||||||
// Menu accroché à la bannière qui devient cachée
|
// Menu accroché à la bannière qui devient cachée
|
||||||
if (
|
if (
|
||||||
$this->getData(['theme', 'header', 'position']) == 'hide' &&
|
$this->getData(['theme', 'header', 'position']) == 'hide' &&
|
||||||
in_array($this->getData(['theme', 'menu', 'position']), ['body-first', 'site-first', 'body-first', 'site-second'])
|
in_array($this->getData(['theme', 'menu', 'position']), ['body-first', 'site-first', 'body-first', 'site-second'])
|
||||||
) {
|
) {
|
||||||
$this->setData(['theme', 'menu', 'position', 'site']);
|
$this->setData(['theme', 'menu', 'position', 'site'], false);
|
||||||
}
|
}
|
||||||
|
// Sauvegarde la base manuellement
|
||||||
|
$this->saveDB(module: 'theme');
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'notification' => helper::translate('Modifications enregistrées'),
|
'notification' => helper::translate('Modifications enregistrées'),
|
||||||
@ -636,11 +638,11 @@ class theme extends common
|
|||||||
// Polices liées aux thèmes des espaces
|
// Polices liées aux thèmes des espaces
|
||||||
foreach ($this->getData(['course']) as $courseId => $courseValue) {
|
foreach ($this->getData(['course']) as $courseId => $courseValue) {
|
||||||
$theme = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/theme.json'), true);
|
$theme = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/theme.json'), true);
|
||||||
$fonts['Bannière ('. $courseId .')'] = $theme['theme']['header']['font'];
|
$fonts['Bannière (' . $courseId . ')'] = $theme['theme']['header']['font'];
|
||||||
$fonts['Menu ('. $courseId .')'] = $theme['theme']['menu']['font'];
|
$fonts['Menu (' . $courseId . ')'] = $theme['theme']['menu']['font'];
|
||||||
$fonts['Titre ('. $courseId .')'] = $theme['theme']['title']['font'];
|
$fonts['Titre (' . $courseId . ')'] = $theme['theme']['title']['font'];
|
||||||
$fonts['Texte ('. $courseId .')'] = $theme['theme']['text']['font'];
|
$fonts['Texte (' . $courseId . ')'] = $theme['theme']['text']['font'];
|
||||||
$fonts['Pied de page ('. $courseId .')'] = $theme['theme']['footer']['font'];
|
$fonts['Pied de page (' . $courseId . ')'] = $theme['theme']['footer']['font'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Récupérer le détail des fontes installées
|
// Récupérer le détail des fontes installées
|
||||||
@ -658,7 +660,7 @@ class theme extends common
|
|||||||
if (is_array($typeValue)) {
|
if (is_array($typeValue)) {
|
||||||
foreach ($typeValue as $fontId => $fontValue) {
|
foreach ($typeValue as $fontId => $fontValue) {
|
||||||
// Recherche les correspondances
|
// Recherche les correspondances
|
||||||
$result = array_filter($fonts, function($value) use ($fontId) {
|
$result = array_filter($fonts, function ($value) use ($fontId) {
|
||||||
return $value == $fontId;
|
return $value == $fontId;
|
||||||
});
|
});
|
||||||
$keyResults = array_keys($result);
|
$keyResults = array_keys($result);
|
||||||
@ -929,7 +931,7 @@ class theme extends common
|
|||||||
'fontWeight' => $this->getInput('themeTitleFontWeight'),
|
'fontWeight' => $this->getInput('themeTitleFontWeight'),
|
||||||
'textTransform' => $this->getInput('themeTitleTextTransform')
|
'textTransform' => $this->getInput('themeTitleTextTransform')
|
||||||
]
|
]
|
||||||
]);
|
], false);
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'theme',
|
'theme',
|
||||||
'text',
|
'text',
|
||||||
@ -939,7 +941,7 @@ class theme extends common
|
|||||||
'textColor' => $this->getInput('themeTextTextColor'),
|
'textColor' => $this->getInput('themeTextTextColor'),
|
||||||
'linkColor' => $this->getInput('themeTextLinkColor')
|
'linkColor' => $this->getInput('themeTextLinkColor')
|
||||||
]
|
]
|
||||||
]);
|
], false);
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'theme',
|
'theme',
|
||||||
'site',
|
'site',
|
||||||
@ -950,14 +952,14 @@ class theme extends common
|
|||||||
'width' => $this->getInput('themeSiteWidth'),
|
'width' => $this->getInput('themeSiteWidth'),
|
||||||
'margin' => $this->getInput('themeSiteMargin', helper::FILTER_BOOLEAN)
|
'margin' => $this->getInput('themeSiteMargin', helper::FILTER_BOOLEAN)
|
||||||
]
|
]
|
||||||
]);
|
], false);
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'theme',
|
'theme',
|
||||||
'button',
|
'button',
|
||||||
[
|
[
|
||||||
'backgroundColor' => $this->getInput('themeButtonBackgroundColor')
|
'backgroundColor' => $this->getInput('themeButtonBackgroundColor')
|
||||||
]
|
]
|
||||||
]);
|
], false);
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'theme',
|
'theme',
|
||||||
'block',
|
'block',
|
||||||
|
@ -428,7 +428,9 @@ class user extends common
|
|||||||
if ($this->getUser('group') < self::GROUP_ADMIN) {
|
if ($this->getUser('group') < self::GROUP_ADMIN) {
|
||||||
if ($this->getInput('userEditNewPassword')) {
|
if ($this->getInput('userEditNewPassword')) {
|
||||||
// L'ancien mot de passe est correct
|
// L'ancien mot de passe est correct
|
||||||
if (password_verify(html_entity_decode($this->getInput('userEditOldPassword')), $this->getData(['user', $this->getUrl(2), 'password']))) {
|
if (
|
||||||
|
password_verify(html_entity_decode($this->getInput('userEditOldPassword')), $this->getData(['user', $this->getUrl(2), 'password']))
|
||||||
|
) {
|
||||||
// La confirmation correspond au mot de passe
|
// La confirmation correspond au mot de passe
|
||||||
if ($this->getInput('userEditNewPassword') === $this->getInput('userEditConfirmPassword')) {
|
if ($this->getInput('userEditNewPassword') === $this->getInput('userEditConfirmPassword')) {
|
||||||
$newPassword = $this->getInput('userEditNewPassword', helper::FILTER_PASSWORD, true);
|
$newPassword = $this->getInput('userEditNewPassword', helper::FILTER_PASSWORD, true);
|
||||||
@ -502,6 +504,7 @@ class user extends common
|
|||||||
'files' => $this->getInput('userEditFiles', helper::FILTER_BOOLEAN),
|
'files' => $this->getInput('userEditFiles', helper::FILTER_BOOLEAN),
|
||||||
'language' => $this->getInput('userEditLanguage', helper::FILTER_STRING_SHORT),
|
'language' => $this->getInput('userEditLanguage', helper::FILTER_STRING_SHORT),
|
||||||
'tags' => $this->getInput('userEditTags', helper::FILTER_STRING_SHORT),
|
'tags' => $this->getInput('userEditTags', helper::FILTER_STRING_SHORT),
|
||||||
|
'authKey' => $this->getData(['user', $this->getUrl(2), 'authKey']),
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
// Redirection spécifique si l'utilisateur change son mot de passe
|
// Redirection spécifique si l'utilisateur change son mot de passe
|
||||||
@ -572,7 +575,7 @@ class user extends common
|
|||||||
// Enregistre la date de la demande dans le compte utilisateur
|
// Enregistre la date de la demande dans le compte utilisateur
|
||||||
$this->setData(['user', $userId, 'forgot', time()]);
|
$this->setData(['user', $userId, 'forgot', time()]);
|
||||||
// Crée un id unique pour la réinitialisation
|
// Crée un id unique pour la réinitialisation
|
||||||
$uniqId = md5(json_encode($this->getData(['user', $userId])));
|
$uniqId = md5(json_encode($this->getData(['user', $userId, 'forgot'])));
|
||||||
// Envoi le mail
|
// Envoi le mail
|
||||||
$sent = $this->sendMail(
|
$sent = $this->sendMail(
|
||||||
$this->getData(['user', $userId, 'mail']),
|
$this->getData(['user', $userId, 'mail']),
|
||||||
@ -895,7 +898,7 @@ class user extends common
|
|||||||
// Droits spécifiques
|
// Droits spécifiques
|
||||||
'users' => $this->getInput('profilEditCourseUsers', helper::FILTER_BOOLEAN),
|
'users' => $this->getInput('profilEditCourseUsers', helper::FILTER_BOOLEAN),
|
||||||
'userHistory' => $this->getInput('profilEditCourseUserHistory', helper::FILTER_BOOLEAN),
|
'userHistory' => $this->getInput('profilEditCourseUserHistory', helper::FILTER_BOOLEAN),
|
||||||
'userHistoryExport' => $this->getInput('profilEditCourseUserHistoryExport', helper::FILTER_BOOLEAN),
|
'userReportExport' => $this->getInput('profilEditCourseuserReportExport', helper::FILTER_BOOLEAN),
|
||||||
'export' => $this->getInput('profilEditCourseExport', helper::FILTER_BOOLEAN),
|
'export' => $this->getInput('profilEditCourseExport', helper::FILTER_BOOLEAN),
|
||||||
'userAdd' => $this->getInput('profilEditCourseUserAdd', helper::FILTER_BOOLEAN),
|
'userAdd' => $this->getInput('profilEditCourseUserAdd', helper::FILTER_BOOLEAN),
|
||||||
'usersAdd' => $this->getInput('profilEditCourseUsersAdd', helper::FILTER_BOOLEAN),
|
'usersAdd' => $this->getInput('profilEditCourseUsersAdd', helper::FILTER_BOOLEAN),
|
||||||
@ -1092,7 +1095,7 @@ class user extends common
|
|||||||
// La suite
|
// La suite
|
||||||
'users' => $this->getInput('profilAddCourseUsers', helper::FILTER_BOOLEAN),
|
'users' => $this->getInput('profilAddCourseUsers', helper::FILTER_BOOLEAN),
|
||||||
'userHistory' => $this->getInput('profilAddCourseUserHistory', helper::FILTER_BOOLEAN),
|
'userHistory' => $this->getInput('profilAddCourseUserHistory', helper::FILTER_BOOLEAN),
|
||||||
'userHistoryExport' => $this->getInput('profilAddCourseUserHistoryExport', helper::FILTER_BOOLEAN),
|
'userReportExport' => $this->getInput('profilAddCourseuserReportExport', helper::FILTER_BOOLEAN),
|
||||||
'export' => $this->getInput('profilAddCourseExport', helper::FILTER_BOOLEAN),
|
'export' => $this->getInput('profilAddCourseExport', helper::FILTER_BOOLEAN),
|
||||||
'userAdd' => $this->getInput('profilAddCourseUserAdd', helper::FILTER_BOOLEAN),
|
'userAdd' => $this->getInput('profilAddCourseUserAdd', helper::FILTER_BOOLEAN),
|
||||||
'usersAdd' => $this->getInput('profilAddCourseUsersAdd', helper::FILTER_BOOLEAN),
|
'usersAdd' => $this->getInput('profilAddCourseUsersAdd', helper::FILTER_BOOLEAN),
|
||||||
@ -1147,12 +1150,12 @@ class user extends common
|
|||||||
|
|
||||||
// Exclure les espaces des cours
|
// Exclure les espaces des cours
|
||||||
/*
|
/*
|
||||||
foreach (array_keys($this->getData(['course'])) as $courseId) {
|
foreach (array_keys($this->getData(['course'])) as $courseId) {
|
||||||
self::$sharePath = array_filter(self::$sharePath, function ($key) use ($courseId) {
|
self::$sharePath = array_filter(self::$sharePath, function ($key) use ($courseId) {
|
||||||
return strpos($key, $courseId) === false;
|
return strpos($key, $courseId) === false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
self::$sharePath = array_flip(self::$sharePath);
|
self::$sharePath = array_flip(self::$sharePath);
|
||||||
self::$sharePath = array_merge(['none' => 'Aucun Accès'], self::$sharePath);
|
self::$sharePath = array_merge(['none' => 'Aucun Accès'], self::$sharePath);
|
||||||
@ -1259,7 +1262,7 @@ class user extends common
|
|||||||
'lastFail' => time(),
|
'lastFail' => time(),
|
||||||
'ip' => helper::getIp()
|
'ip' => helper::getIp()
|
||||||
]
|
]
|
||||||
]);
|
], false);
|
||||||
// Verrouillage des IP
|
// Verrouillage des IP
|
||||||
$ipBlackList = helper::arrayColumn($this->getData(['blacklist']), 'ip');
|
$ipBlackList = helper::arrayColumn($this->getData(['blacklist']), 'ip');
|
||||||
if (
|
if (
|
||||||
@ -1288,8 +1291,8 @@ class user extends common
|
|||||||
$this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) < time()
|
$this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) < time()
|
||||||
and $this->getData(['user', $userId, 'connectFail']) === $this->getData(['config', 'connect', 'attempt'])
|
and $this->getData(['user', $userId, 'connectFail']) === $this->getData(['config', 'connect', 'attempt'])
|
||||||
) {
|
) {
|
||||||
$this->setData(['user', $userId, 'connectFail', 0]);
|
$this->setData(['user', $userId, 'connectFail', 0], false);
|
||||||
$this->setData(['user', $userId, 'connectTimeout', 0]);
|
$this->setData(['user', $userId, 'connectTimeout', 0], false);
|
||||||
}
|
}
|
||||||
// Check la présence des variables et contrôle du blocage du compte si valeurs dépassées
|
// Check la présence des variables et contrôle du blocage du compte si valeurs dépassées
|
||||||
// Vérification du mot de passe et du groupe
|
// Vérification du mot de passe et du groupe
|
||||||
@ -1301,8 +1304,12 @@ class user extends common
|
|||||||
and $captcha === true
|
and $captcha === true
|
||||||
) {
|
) {
|
||||||
// RAZ
|
// RAZ
|
||||||
$this->setData(['user', $userId, 'connectFail', 0]);
|
$this->setData(['user', $userId, 'connectFail', 0], false);
|
||||||
$this->setData(['user', $userId, 'connectTimeout', 0]);
|
$this->setData(['user', $userId, 'connectTimeout', 0], false);
|
||||||
|
|
||||||
|
// Clé d'authenfication
|
||||||
|
$authKey = uniqid('', true) . bin2hex(random_bytes(8));
|
||||||
|
$this->setData(['user', $userId, 'authKey', $authKey], false);
|
||||||
|
|
||||||
// Validité du cookie
|
// Validité du cookie
|
||||||
$expire = $this->getInput('userLoginLongTime', helper::FILTER_BOOLEAN) === true ? strtotime("+1 year") : 0;
|
$expire = $this->getInput('userLoginLongTime', helper::FILTER_BOOLEAN) === true ? strtotime("+1 year") : 0;
|
||||||
@ -1310,17 +1317,23 @@ class user extends common
|
|||||||
case false:
|
case false:
|
||||||
// Cookie de session
|
// Cookie de session
|
||||||
setcookie('ZWII_USER_ID', $userId, $expire, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
setcookie('ZWII_USER_ID', $userId, $expire, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
||||||
setcookie('ZWII_USER_PASSWORD', $this->getData(['user', $userId, 'password']), $expire, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
//setcookie('ZWII_USER_PASSWORD', $this->getData(['user', $userId, 'password']), $expire, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
||||||
|
|
||||||
|
// Connexion par clé
|
||||||
|
setcookie('ZWII_AUTH_KEY', $authKey, $expire, helper::baseUrl(false, false), '', helper::isHttps(), true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Cookie persistant
|
// Cookie persistant
|
||||||
setcookie('ZWII_USER_ID', $userId, $expire, helper::baseUrl(false, false));
|
setcookie('ZWII_USER_ID', $userId, $expire, helper::baseUrl(false, false));
|
||||||
setcookie('ZWII_USER_PASSWORD', $this->getData(['user', $userId, 'password']), $expire, helper::baseUrl(false, false));
|
//setcookie('ZWII_USER_PASSWORD', $this->getData(['user', $userId, 'password']), $expire, helper::baseUrl(false, false));
|
||||||
|
|
||||||
|
// Connexion par clé
|
||||||
|
setcookie('ZWII_AUTH_KEY', $authKey, $expire, helper::baseUrl(false, false));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accès multiples avec le même compte
|
// Accès multiples avec le même compte
|
||||||
$this->setData(['user', $userId, 'accessCsrf', $_SESSION['csrf']]);
|
$this->setData(['user', $userId, 'accessCsrf', $_SESSION['csrf']], false);
|
||||||
// Valeurs en sortie lorsque le site est en maintenance et que l'utilisateur n'est pas administrateur
|
// Valeurs en sortie lorsque le site est en maintenance et que l'utilisateur n'est pas administrateur
|
||||||
if (
|
if (
|
||||||
$this->getData(['config', 'maintenance'])
|
$this->getData(['config', 'maintenance'])
|
||||||
@ -1354,11 +1367,11 @@ class user extends common
|
|||||||
$logStatus = $captcha === true ? 'Erreur de mot de passe' : 'Erreur de captcha';
|
$logStatus = $captcha === true ? 'Erreur de mot de passe' : 'Erreur de captcha';
|
||||||
// Cas 1 le nombre de connexions est inférieur aux tentatives autorisées : incrément compteur d'échec
|
// Cas 1 le nombre de connexions est inférieur aux tentatives autorisées : incrément compteur d'échec
|
||||||
if ($this->getData(['user', $userId, 'connectFail']) < $this->getData(['config', 'connect', 'attempt'])) {
|
if ($this->getData(['user', $userId, 'connectFail']) < $this->getData(['config', 'connect', 'attempt'])) {
|
||||||
$this->setData(['user', $userId, 'connectFail', $this->getdata(['user', $userId, 'connectFail']) + 1]);
|
$this->setData(['user', $userId, 'connectFail', $this->getdata(['user', $userId, 'connectFail']) + 1], false);
|
||||||
}
|
}
|
||||||
// Cas 2 la limite du nombre de connexion est atteinte : placer le timer
|
// Cas 2 la limite du nombre de connexion est atteinte : placer le timer
|
||||||
if ($this->getdata(['user', $userId, 'connectFail']) == $this->getData(['config', 'connect', 'attempt'])) {
|
if ($this->getdata(['user', $userId, 'connectFail']) == $this->getData(['config', 'connect', 'attempt'])) {
|
||||||
$this->setData(['user', $userId, 'connectTimeout', time()]);
|
$this->setData(['user', $userId, 'connectTimeout', time()], false);
|
||||||
}
|
}
|
||||||
// Cas 3 le délai de bloquage court
|
// Cas 3 le délai de bloquage court
|
||||||
if ($this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) > time()) {
|
if ($this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) > time()) {
|
||||||
@ -1371,7 +1384,10 @@ class user extends common
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Sauvegarde la base manuellement
|
||||||
|
$this->saveDB(module: 'user');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Journalisation
|
// Journalisation
|
||||||
$this->saveLog($logStatus);
|
$this->saveLog($logStatus);
|
||||||
|
|
||||||
@ -1394,7 +1410,8 @@ class user extends common
|
|||||||
public function logout()
|
public function logout()
|
||||||
{
|
{
|
||||||
helper::deleteCookie('ZWII_USER_ID');
|
helper::deleteCookie('ZWII_USER_ID');
|
||||||
helper::deleteCookie('ZWII_USER_PASSWORD');
|
//helper::deleteCookie('ZWII_USER_PASSWORD');
|
||||||
|
helper::deleteCookie('ZWII_AUTH_KEY');
|
||||||
|
|
||||||
// Détruit la session
|
// Détruit la session
|
||||||
session_destroy();
|
session_destroy();
|
||||||
@ -1419,13 +1436,29 @@ class user extends common
|
|||||||
// Lien de réinitialisation trop vieux
|
// Lien de réinitialisation trop vieux
|
||||||
or $this->getData(['user', $this->getUrl(2), 'forgot']) + 86400 < time()
|
or $this->getData(['user', $this->getUrl(2), 'forgot']) + 86400 < time()
|
||||||
// Id unique incorrecte
|
// Id unique incorrecte
|
||||||
or $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2)])))
|
or $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2), 'forgot'])))
|
||||||
) {
|
) {
|
||||||
|
$this->saveLog(
|
||||||
|
' Erreur de réinitialisation de mot de passe ' . $this->getUrl(2) .
|
||||||
|
' Compte : ' . $this->getData(['user', $this->getUrl(2)]) .
|
||||||
|
' Temps : ' . $this->getData(['user', $this->getUrl(2), 'forgot']) + 86400 < time() .
|
||||||
|
' Clé : ' . $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2), 'forgot'])))
|
||||||
|
);
|
||||||
|
// Message d'erreur en cas de problème de réinitialisation de mot de passe
|
||||||
|
$message = $this->getData(['user', $this->getUrl(2)]) === null
|
||||||
|
? ' Utilisateur inconnu '
|
||||||
|
: '';
|
||||||
|
$message = $this->getData(['user', $this->getUrl(2), 'forgot']) + 86400 < time()
|
||||||
|
? ' Temps dépassé '
|
||||||
|
: $message;
|
||||||
|
$message = $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2)])))
|
||||||
|
? ' Clé invalide '
|
||||||
|
: $message;
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseurl(),
|
'redirect' => helper::baseurl(),
|
||||||
'notification' => helper::translate('Impossible de réinitialiser le mot de passe de ce compte !'),
|
'notification' => helper::translate('Impossible de réinitialiser le mot de passe de ce compte !') . $message,
|
||||||
'state' => false
|
'state' => false
|
||||||
//'access' => false
|
//'access' => false
|
||||||
]);
|
]);
|
||||||
@ -1448,12 +1481,14 @@ class user extends common
|
|||||||
$newPassword = $this->getInput('userResetNewPassword', helper::FILTER_PASSWORD, true);
|
$newPassword = $this->getInput('userResetNewPassword', helper::FILTER_PASSWORD, true);
|
||||||
}
|
}
|
||||||
// Modifie le mot de passe
|
// Modifie le mot de passe
|
||||||
$this->setData(['user', $this->getUrl(2), 'password', $newPassword]);
|
$this->setData(['user', $this->getUrl(2), 'password', $newPassword], false);
|
||||||
// Réinitialise la date de la demande
|
// Réinitialise la date de la demande
|
||||||
$this->setData(['user', $this->getUrl(2), 'forgot', 0]);
|
$this->setData(['user', $this->getUrl(2), 'forgot', 0], false);
|
||||||
// Réinitialise le blocage
|
// Réinitialise le blocage
|
||||||
$this->setData(['user', $this->getUrl(2), 'connectFail', 0]);
|
$this->setData(['user', $this->getUrl(2), 'connectFail', 0], false);
|
||||||
$this->setData(['user', $this->getUrl(2), 'connectTimeout', 0]);
|
$this->setData(['user', $this->getUrl(2), 'connectTimeout', 0], false);
|
||||||
|
// Sauvegarde la base manuellement
|
||||||
|
$this->saveDB('user');
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'notification' => helper::translate('Nouveau mot de passe enregistré'),
|
'notification' => helper::translate('Nouveau mot de passe enregistré'),
|
||||||
@ -1567,7 +1602,7 @@ class user extends common
|
|||||||
"accessCsrf" => null,
|
"accessCsrf" => null,
|
||||||
'tags' => $item['tags']
|
'tags' => $item['tags']
|
||||||
]
|
]
|
||||||
]);
|
], false);
|
||||||
// Icône de notification
|
// Icône de notification
|
||||||
$item['notification'] = $create ? template::ico('check') : template::ico('cancel');
|
$item['notification'] = $create ? template::ico('check') : template::ico('cancel');
|
||||||
// Envoi du mail
|
// Envoi du mail
|
||||||
@ -1608,6 +1643,8 @@ class user extends common
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Sauvegarde la base manuellement
|
||||||
|
$this->saveDB(module: 'user');
|
||||||
if (empty(self::$users)) {
|
if (empty(self::$users)) {
|
||||||
$notification = helper::translate('Rien à importer, erreur de format ou fichier incorrect');
|
$notification = helper::translate('Rien à importer, erreur de format ou fichier incorrect');
|
||||||
$success = false;
|
$success = false;
|
||||||
@ -1668,7 +1705,7 @@ class user extends common
|
|||||||
if (
|
if (
|
||||||
isset($_POST['usersTagSubmit'])
|
isset($_POST['usersTagSubmit'])
|
||||||
) {
|
) {
|
||||||
$notification = helper::translate('Modification de %s étiquette');
|
$notification = helper::translate('Modification de %s étiquette(s)');
|
||||||
$success = true;
|
$success = true;
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$newTags = $this->getInput('usersTagLabel', null, true);
|
$newTags = $this->getInput('usersTagLabel', null, true);
|
||||||
@ -1677,10 +1714,12 @@ class user extends common
|
|||||||
if (
|
if (
|
||||||
$this->getData(['user', $keyPost]) !== null
|
$this->getData(['user', $keyPost]) !== null
|
||||||
) {
|
) {
|
||||||
$this->setData(['user', $keyPost, 'tags', $newTags]);
|
$this->setData(['user', $keyPost, 'tags', $newTags], false);
|
||||||
$count += 1;
|
$count += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Sauvegarde la base manuellement
|
||||||
|
$this->saveDB(module: 'user');
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . 'user/tag',
|
'redirect' => helper::baseUrl() . 'user/tag',
|
||||||
@ -1689,7 +1728,7 @@ class user extends common
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Liste des groupes et des profils
|
// Liste des groupes et des profils
|
||||||
$usersGroups = $this->getData(['profil']);
|
$usersGroups = $this->getData(['profil']);
|
||||||
|
@ -29,6 +29,7 @@ $(document).ready((function () {
|
|||||||
},
|
},
|
||||||
locale: 'fr',
|
locale: 'fr',
|
||||||
stateSave: true,
|
stateSave: true,
|
||||||
|
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "Tout"]],
|
||||||
"columnDefs": [
|
"columnDefs": [
|
||||||
{
|
{
|
||||||
target: 5,
|
target: 5,
|
||||||
|
@ -8,4 +8,32 @@
|
|||||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||||
* @link http://zwiicms.fr/
|
* @link http://zwiicms.fr/
|
||||||
*/
|
*/
|
||||||
$(document).ready((function(){$(".zwiico-eye").mouseenter((function(){$("#userLoginPassword").attr("type","text")})),$(".zwiico-eye").mouseleave((function(){$("#userLoginPassword").attr("type","password")}))}));
|
$(document).ready((function() {
|
||||||
|
$("#userLoginId").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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".zwiico-eye").mouseenter((function() {
|
||||||
|
$("#userLoginPassword").attr("type", "text")
|
||||||
|
})), $(".zwiico-eye").mouseleave((function() {
|
||||||
|
$("#userLoginPassword").attr("type", "password")
|
||||||
|
}))
|
||||||
|
}));
|
@ -196,7 +196,7 @@
|
|||||||
<?php echo template::checkbox('profilAddCourseUserHistory', true, 'Voir historique d\'un participant'); ?>
|
<?php echo template::checkbox('profilAddCourseUserHistory', true, 'Voir historique d\'un participant'); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::checkbox('profilAddCourseUserHistoryExport', true, 'Exporter historique d\'un participant'); ?>
|
<?php echo template::checkbox('profilAddCourseuserReportExport', true, 'Exporter historique d\'un participant'); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::checkbox('profilAddCourseUserDelete', true, 'Désinscrire un participant'); ?>
|
<?php echo template::checkbox('profilAddCourseUserDelete', true, 'Désinscrire un participant'); ?>
|
||||||
|
@ -56,10 +56,10 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
if ($('#profilEditCourseUsers').is(':checked')) {
|
if ($('#profilEditCourseUsers').is(':checked')) {
|
||||||
// Activer les autres checkboxes
|
// Activer les autres checkboxes
|
||||||
$('#profilEditCourseUserHistory, #profilEditCourseUserHistoryExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('disabled', false);
|
$('#profilEditCourseUserHistory, #profilEditCourseuserReportExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('disabled', false);
|
||||||
} else {
|
} else {
|
||||||
// Désactiver les autres checkboxes
|
// Désactiver les autres checkboxes
|
||||||
$('#profilEditCourseUserHistory, #profilEditCourseUserHistoryExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('checked', false).prop('disabled', true);
|
$('#profilEditCourseUserHistory, #profilEditCourseuserReportExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('checked', false).prop('disabled', true);
|
||||||
// Désactiver les modules et tout décocher
|
// Désactiver les modules et tout décocher
|
||||||
$(".courseContainer").slideUp();
|
$(".courseContainer").slideUp();
|
||||||
$('.courseContainer input[type="checkbox"]').prop('checked', false);
|
$('.courseContainer input[type="checkbox"]').prop('checked', false);
|
||||||
@ -135,11 +135,11 @@ $(document).ready(function () {
|
|||||||
$('#profilEditCourseUsers').change(function () {
|
$('#profilEditCourseUsers').change(function () {
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
// Activer les autres checkboxes
|
// Activer les autres checkboxes
|
||||||
$('#profilEditCourseUserHistory, #profilEditCourseUserHistoryExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('disabled', false);
|
$('#profilEditCourseUserHistory, #profilEditCourseuserReportExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('disabled', false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Désactiver les autres checkboxes
|
// Désactiver les autres checkboxes
|
||||||
$('#profilEditCourseUserHistory, #profilEditCourseUserHistoryExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('checked', false).prop('disabled', true);
|
$('#profilEditCourseUserHistory, #profilEditCourseuserReportExport, #profilEditCourseUserDelete, #profilEditCourseUsersAdd, #profilEditCourseUsersDelete, #profilEditCourseReset').prop('checked', false).prop('disabled', true);
|
||||||
// Désactiver les modules et tout décocher
|
// Désactiver les modules et tout décocher
|
||||||
$(".courseContainer").slideUp();
|
$(".courseContainer").slideUp();
|
||||||
$('.courseContainer input[type="checkbox"]').prop('checked', false);
|
$('.courseContainer input[type="checkbox"]').prop('checked', false);
|
||||||
|
@ -291,8 +291,8 @@
|
|||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::checkbox('profilEditCourseUserHistoryExport', true, 'Exporter historique d\'un participant', [
|
<?php echo template::checkbox('profilEditCourseuserReportExport', true, 'Exporter historique d\'un participant', [
|
||||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'userHistoryExport']),
|
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'userReportExport']),
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
'value' => template::ico('left')
|
'value' => template::ico('left')
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col1">
|
<div class="col1 offset10">
|
||||||
<?php echo template::submit('usersDeleteSubmit', [
|
<?php echo template::submit('usersDeleteSubmit', [
|
||||||
'class' => 'buttonRed',
|
'class' => 'buttonRed',
|
||||||
'ico' => '',
|
'ico' => '',
|
||||||
|
4
core/vendor/datatables/inc.json
vendored
4
core/vendor/datatables/inc.json
vendored
@ -1,5 +1,7 @@
|
|||||||
[
|
[
|
||||||
"datatables.min.js",
|
"datatables.min.js",
|
||||||
|
"moment.min.js",
|
||||||
|
"datetime.min.js",
|
||||||
"datatables.min.css",
|
"datatables.min.css",
|
||||||
"datatables.custom.css"
|
"datatables.custom.css"
|
||||||
]
|
]
|
5
core/vendor/filemanager/UploadHandler.php
vendored
5
core/vendor/filemanager/UploadHandler.php
vendored
@ -1506,8 +1506,9 @@ class UploadHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$newWidth = 640;
|
||||||
$thumbResult = create_img($targetFile, $targetFileThumb, 122, 91);
|
$newHeight = 480;
|
||||||
|
$thumbResult = create_img($targetFile, $targetFileThumb, $newWidth, $newHeight);
|
||||||
|
|
||||||
if ( $thumbResult!==true)
|
if ( $thumbResult!==true)
|
||||||
{
|
{
|
||||||
|
4
core/vendor/filemanager/config/config.php
vendored
4
core/vendor/filemanager/config/config.php
vendored
@ -19,7 +19,7 @@ setlocale(LC_CTYPE, $lang);
|
|||||||
|
|
||||||
/* Lecture du groupe de l'utilisateur connecté pour attribuer les droits et les dossiers */
|
/* Lecture du groupe de l'utilisateur connecté pour attribuer les droits et les dossiers */
|
||||||
$userId = $_COOKIE['ZWII_USER_ID'];
|
$userId = $_COOKIE['ZWII_USER_ID'];
|
||||||
$courseId = $_COOKIE['ZWII_SITE_CONTENT'];
|
$courseId = $_GET['lang'];
|
||||||
$u = json_decode(file_get_contents('../../../site/data/user.json'), true);
|
$u = json_decode(file_get_contents('../../../site/data/user.json'), true);
|
||||||
$g = json_decode(file_get_contents('../../../site/data/profil.json'), true);
|
$g = json_decode(file_get_contents('../../../site/data/profil.json'), true);
|
||||||
|
|
||||||
@ -609,7 +609,7 @@ $config = array(
|
|||||||
// path_from_filemanager/test/test1/
|
// path_from_filemanager/test/test1/
|
||||||
// PS if there isn't write permission in your destination folder you must set it
|
// PS if there isn't write permission in your destination folder you must set it
|
||||||
//
|
//
|
||||||
'fixed_image_creation' => true,
|
'fixed_image_creation' => false,
|
||||||
//activate or not the creation of one or more image resized with fixed path from filemanager folder
|
//activate or not the creation of one or more image resized with fixed path from filemanager folder
|
||||||
'fixed_path_from_filemanager' => array('../../../site/file/thumb/'),
|
'fixed_path_from_filemanager' => array('../../../site/file/thumb/'),
|
||||||
//fixed path of the image folder from the current position on upload folder
|
//fixed path of the image folder from the current position on upload folder
|
||||||
|
126
core/vendor/tinymce/init.js
vendored
126
core/vendor/tinymce/init.js
vendored
@ -10,23 +10,43 @@
|
|||||||
if (typeof (privateKey) == 'undefined') {
|
if (typeof (privateKey) == 'undefined') {
|
||||||
var privateKey = null;
|
var privateKey = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
tinymce.init({
|
tinymce.init({
|
||||||
// Classe où appliquer l'éditeur
|
// Classe où appliquer l'éditeur
|
||||||
selector: ".editorWysiwyg",
|
selector: ".editorWysiwyg",
|
||||||
// Aperçu dans le pied de page
|
// Aperçu dans le pied de page
|
||||||
setup: function (ed) {
|
setup: function (editor) {
|
||||||
ed.on('change', function (e) {
|
// Événement 'change'
|
||||||
if (ed.id === 'themeFooterText') {
|
editor.on('change', function (e) {
|
||||||
|
if (editor.id === 'themeFooterText') {
|
||||||
$("#footerText").html(tinyMCE.get('themeFooterText').getContent());
|
$("#footerText").html(tinyMCE.get('themeFooterText').getContent());
|
||||||
}
|
}
|
||||||
if (ed.id === 'themeHeaderText') {
|
if (editor.id === 'themeHeaderText') {
|
||||||
$("#featureContent").html(tinyMCE.get('themeHeaderText').getContent());
|
$("#featureContent").html(tinyMCE.get('themeHeaderText').getContent());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Événement 'init'
|
||||||
|
// Cette partie permet de récupérer l'attribut de zwii_site_content qui contient le code de l'espace ouvert stocké dans la session php
|
||||||
|
editor.on('init', function () {
|
||||||
|
var siteContent = document.getElementById('zwii_site_content').getAttribute('data-variable');
|
||||||
|
siteContent = siteContent === null ? 'home' : siteContent;
|
||||||
|
|
||||||
|
// Charger le contenu CSS avec siteContent
|
||||||
|
var newStylesheetUrls = [
|
||||||
|
baseUrl + "core/layout/common.css",
|
||||||
|
baseUrl + "core/vendor/tinymce/content.css",
|
||||||
|
baseUrl + "site/data/" + siteContent + "/theme.css",
|
||||||
|
baseUrl + "site/data/custom.css"
|
||||||
|
];
|
||||||
|
// Supprime les anciennes feuilles de style si nécessaire
|
||||||
|
newStylesheetUrls.forEach(function(url) {
|
||||||
|
editor.dom.loadCSS(url); // Charger les nouvelles feuilles de style
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// Langue
|
// Langue
|
||||||
language: getCookie('ZWII_UI') === null ? "fr_FR" : getCookie('ZWII_UI'),
|
language:"fr_FR",
|
||||||
// Plugins
|
// Plugins
|
||||||
plugins: "advlist anchor autolink autoresize autosave codemirror contextmenu colorpicker fullscreen hr image imagetools link lists media paste searchreplace tabfocus table template textcolor visualblocks nonbreaking emoticons charmap textpattern",
|
plugins: "advlist anchor autolink autoresize autosave codemirror contextmenu colorpicker fullscreen hr image imagetools link lists media paste searchreplace tabfocus table template textcolor visualblocks nonbreaking emoticons charmap textpattern",
|
||||||
// Contenu du menu
|
// Contenu du menu
|
||||||
@ -35,7 +55,6 @@ tinymce.init({
|
|||||||
edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall | searchreplace' },
|
edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall | searchreplace' },
|
||||||
view: { title: 'View', items: 'code | visualaid visualblocks | fullscreen' },
|
view: { title: 'View', items: 'code | visualaid visualblocks | fullscreen' },
|
||||||
insert: { title: 'Insert', items: 'image link media pageembed template inserttable | charmap emoticons hr | nonbreaking anchor' },
|
insert: { title: 'Insert', items: 'image link media pageembed template inserttable | charmap emoticons hr | nonbreaking anchor' },
|
||||||
//format: { title: 'Format', items: 'bold italic underline strikethrough superscript subscript codeformat | styles blocks fontfamily fontsize align lineheight | forecolor backcolor | removeformat' },
|
|
||||||
tools: { title: 'Tools', items: '' },
|
tools: { title: 'Tools', items: '' },
|
||||||
table: { title: 'Table', items: 'inserttable | cell row column | tableprops deletetable' },
|
table: { title: 'Table', items: 'inserttable | cell row column | tableprops deletetable' },
|
||||||
help: { title: 'Help', items: 'help' }
|
help: { title: 'Help', items: 'help' }
|
||||||
@ -56,7 +75,6 @@ tinymce.init({
|
|||||||
saveCursorPosition: false, // Insert caret marker
|
saveCursorPosition: false, // Insert caret marker
|
||||||
config: { // CodeMirror config object
|
config: { // CodeMirror config object
|
||||||
fullscreen: true,
|
fullscreen: true,
|
||||||
/*mode: 'application/x-httpd-php',*/
|
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
indentUnit: 4,
|
indentUnit: 4,
|
||||||
mode: "htmlmixed"
|
mode: "htmlmixed"
|
||||||
@ -71,12 +89,8 @@ tinymce.init({
|
|||||||
'addon/search/searchcursor.js',
|
'addon/search/searchcursor.js',
|
||||||
'addon/search/search.js',
|
'addon/search/search.js',
|
||||||
],
|
],
|
||||||
/*
|
width: 800,
|
||||||
cssFiles: [
|
height: 500
|
||||||
'theme/cobalt.css',
|
|
||||||
],*/
|
|
||||||
width: 800, // Default value is 800
|
|
||||||
height: 500 // Default value is 550
|
|
||||||
},
|
},
|
||||||
// Cibles de la target
|
// Cibles de la target
|
||||||
target_list: [
|
target_list: [
|
||||||
@ -89,7 +103,7 @@ tinymce.init({
|
|||||||
{ title: 'Une popup (Lity)', value: 'data-lity' },
|
{ title: 'Une popup (Lity)', value: 'data-lity' },
|
||||||
{ title: 'Une galerie d\'images (SimpleLightbox)', value: 'gallery' }
|
{ title: 'Une galerie d\'images (SimpleLightbox)', value: 'gallery' }
|
||||||
],
|
],
|
||||||
// Titre des image
|
// Titre des images
|
||||||
image_title: true,
|
image_title: true,
|
||||||
// Pages internes
|
// Pages internes
|
||||||
link_list: baseUrl + "core/vendor/tinymce/links.php",
|
link_list: baseUrl + "core/vendor/tinymce/links.php",
|
||||||
@ -99,7 +113,7 @@ tinymce.init({
|
|||||||
content_css: [
|
content_css: [
|
||||||
baseUrl + "core/layout/common.css",
|
baseUrl + "core/layout/common.css",
|
||||||
baseUrl + "core/vendor/tinymce/content.css",
|
baseUrl + "core/vendor/tinymce/content.css",
|
||||||
baseUrl + "site/data/"+ (getCookie("ZWII_SITE_CONTENT") === null ? 'home' : getCookie("ZWII_SITE_CONTENT")) +"/theme.css",
|
baseUrl + "site/data/home/theme.css", // Ceci sera mis à jour dans l'événement 'init'
|
||||||
baseUrl + "site/data/custom.css"
|
baseUrl + "site/data/custom.css"
|
||||||
],
|
],
|
||||||
// Classe à ajouter à la balise body dans l'iframe
|
// Classe à ajouter à la balise body dans l'iframe
|
||||||
@ -226,26 +240,26 @@ tinymce.init({
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
textpattern_patterns: [
|
textpattern_patterns: [
|
||||||
{start: '*', end: '*', format: 'italic'},
|
{ start: '*', end: '*', format: 'italic' },
|
||||||
{start: '**', end: '**', format: 'bold'},
|
{ start: '**', end: '**', format: 'bold' },
|
||||||
{start: '#', format: 'h1'},
|
{ start: '#', format: 'h1' },
|
||||||
{start: '##', format: 'h2'},
|
{ start: '##', format: 'h2' },
|
||||||
{start: '###', format: 'h3'},
|
{ start: '###', format: 'h3' },
|
||||||
{start: '####', format: 'h4'},
|
{ start: '####', format: 'h4' },
|
||||||
{start: '#####', format: 'h5'},
|
{ start: '#####', format: 'h5' },
|
||||||
{start: '######', format: 'h6'},
|
{ start: '######', format: 'h6' },
|
||||||
{start: '1. ', cmd: 'InsertOrderedList'},
|
{ start: '1. ', cmd: 'InsertOrderedList' },
|
||||||
{start: '* ', cmd: 'InsertUnorderedList'},
|
{ start: '* ', cmd: 'InsertUnorderedList' },
|
||||||
{start: '- ', cmd: 'InsertUnorderedList'},
|
{ start: '- ', cmd: 'InsertUnorderedList' },
|
||||||
{start: '* ', cmd: 'InsertUnorderedList'},
|
{ start: '* ', cmd: 'InsertUnorderedList' },
|
||||||
{start: '- ', cmd: 'InsertUnorderedList'},
|
{ start: '- ', cmd: 'InsertUnorderedList' },
|
||||||
{start: '1. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' }},
|
{ start: '1. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' } },
|
||||||
{start: '1) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' }},
|
{ start: '1) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' } },
|
||||||
{start: 'a. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' }},
|
{ start: 'a. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' } },
|
||||||
{start: 'a) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' }},
|
{ start: 'a) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' } },
|
||||||
{start: 'i. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' }},
|
{ start: 'i. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' } },
|
||||||
{start: 'i) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' }}
|
{ start: 'i) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' } }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -302,7 +316,7 @@ tinymce.init({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
// Langue
|
// Langue
|
||||||
language: getCookie('ZWII_UI') === null ? "fr_FR" : getCookie('ZWII_UI'),
|
language: "fr_FR",
|
||||||
// Plugins
|
// Plugins
|
||||||
plugins: "advlist anchor autolink autoresize autosave colorpicker contextmenu hr lists paste searchreplace tabfocus template textcolor textpattern",
|
plugins: "advlist anchor autolink autoresize autosave colorpicker contextmenu hr lists paste searchreplace tabfocus template textcolor textpattern",
|
||||||
// Contenu de la barre d'outils
|
// Contenu de la barre d'outils
|
||||||
@ -344,26 +358,26 @@ tinymce.init({
|
|||||||
document_base_url: baseUrl,
|
document_base_url: baseUrl,
|
||||||
max_height: 200,
|
max_height: 200,
|
||||||
textpattern_patterns: [
|
textpattern_patterns: [
|
||||||
{start: '*', end: '*', format: 'italic'},
|
{ start: '*', end: '*', format: 'italic' },
|
||||||
{start: '**', end: '**', format: 'bold'},
|
{ start: '**', end: '**', format: 'bold' },
|
||||||
{start: '#', format: 'h1'},
|
{ start: '#', format: 'h1' },
|
||||||
{start: '##', format: 'h2'},
|
{ start: '##', format: 'h2' },
|
||||||
{start: '###', format: 'h3'},
|
{ start: '###', format: 'h3' },
|
||||||
{start: '####', format: 'h4'},
|
{ start: '####', format: 'h4' },
|
||||||
{start: '#####', format: 'h5'},
|
{ start: '#####', format: 'h5' },
|
||||||
{start: '######', format: 'h6'},
|
{ start: '######', format: 'h6' },
|
||||||
{start: '1. ', cmd: 'InsertOrderedList'},
|
{ start: '1. ', cmd: 'InsertOrderedList' },
|
||||||
{start: '* ', cmd: 'InsertUnorderedList'},
|
{ start: '* ', cmd: 'InsertUnorderedList' },
|
||||||
{start: '- ', cmd: 'InsertUnorderedList'},
|
{ start: '- ', cmd: 'InsertUnorderedList' },
|
||||||
{start: '* ', cmd: 'InsertUnorderedList'},
|
{ start: '* ', cmd: 'InsertUnorderedList' },
|
||||||
{start: '- ', cmd: 'InsertUnorderedList'},
|
{ start: '- ', cmd: 'InsertUnorderedList' },
|
||||||
{start: '1. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' }},
|
{ start: '1. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' } },
|
||||||
{start: '1) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' }},
|
{ start: '1) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' } },
|
||||||
{start: 'a. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' }},
|
{ start: 'a. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' } },
|
||||||
{start: 'a) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' }},
|
{ start: 'a) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' } },
|
||||||
{start: 'i. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' }},
|
{ start: 'i. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' } },
|
||||||
{start: 'i) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' }}
|
{ start: 'i) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' } }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
30
index.php
30
index.php
@ -14,11 +14,35 @@
|
|||||||
* @link http://zwiicms.fr/
|
* @link http://zwiicms.fr/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialisation de Zwii
|
* Initialisation de Zwii
|
||||||
*/
|
*/
|
||||||
// Remplace la directive htaccess
|
// Remplace la directive htaccess
|
||||||
ini_set('session.use_trans_sid', FALSE);
|
ini_set('session.use_trans_sid', FALSE);
|
||||||
|
|
||||||
|
// Crée un identifiant unique pour chaque site en fonction du nom de domaine ou autre
|
||||||
|
$siteId = md5($_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_FILENAME']); // Ou utilise un autre identifiant unique pour chaque site
|
||||||
|
// Change le nom de la session en fonction de cet identifiant
|
||||||
|
session_name('zwii_session_' . $siteId);
|
||||||
|
|
||||||
|
// Récupère dynamiquement le chemin du dossier dans lequel le script est exécuté
|
||||||
|
$scriptPath = dirname($_SERVER['SCRIPT_NAME']);
|
||||||
|
|
||||||
|
// Si le chemin est vide (ce qui peut arriver si le site est à la racine), définis-le comme '/'
|
||||||
|
if ($scriptPath === '/' || $scriptPath === '\\' || $scriptPath === '.') {
|
||||||
|
$scriptPath = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Définissez le chemin du cookie de session dynamiquement
|
||||||
|
session_set_cookie_params([
|
||||||
|
'lifetime' => 0,
|
||||||
|
'path' => $scriptPath, // Utilise le chemin du script pour restreindre la session à ce répertoire
|
||||||
|
'domain' => $_SERVER['SERVER_NAME'], // Domaine par défaut
|
||||||
|
'secure' => isset($_SERVER['HTTPS']), // Pour HTTPS, si nécessaire
|
||||||
|
'httponly' => true,
|
||||||
|
'samesite' => 'Lax' // Ou 'Strict' ou 'None' selon tes besoins
|
||||||
|
]);
|
||||||
|
|
||||||
// Démarre la session
|
// Démarre la session
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
@ -34,7 +58,7 @@ include_once('core/include/checkup.php');
|
|||||||
* fr_FR.utf8 : la majorité
|
* fr_FR.utf8 : la majorité
|
||||||
*/
|
*/
|
||||||
date_default_timezone_set('Europe/Paris');
|
date_default_timezone_set('Europe/Paris');
|
||||||
setlocale (LC_ALL, 'fr_FR.UTF8', 'fr_FR', 'french');
|
setlocale(LC_ALL, 'fr_FR.UTF8', 'fr_FR', 'french');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chargement des classes
|
* Chargement des classes
|
||||||
@ -47,4 +71,4 @@ spl_autoload_register('core::autoload');
|
|||||||
* Chargement du coeur
|
* Chargement du coeur
|
||||||
*/
|
*/
|
||||||
$core = new core;
|
$core = new core;
|
||||||
echo $core->router();
|
echo $core->router();
|
@ -16,7 +16,7 @@
|
|||||||
class blog extends common
|
class blog extends common
|
||||||
{
|
{
|
||||||
|
|
||||||
const VERSION = '7.11';
|
const VERSION = '8.0';
|
||||||
const REALNAME = 'Blog';
|
const REALNAME = 'Blog';
|
||||||
const DELETE = true;
|
const DELETE = true;
|
||||||
const UPDATE = '0.0';
|
const UPDATE = '0.0';
|
||||||
@ -174,10 +174,12 @@ class blog extends common
|
|||||||
$this->setData(['module', $this->getUrl(0), 'config', 'timeFormat', '%H:%M']);
|
$this->setData(['module', $this->getUrl(0), 'config', 'timeFormat', '%H:%M']);
|
||||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '6.5']);
|
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '6.5']);
|
||||||
}
|
}
|
||||||
// Version 7.4
|
// Version 8.0
|
||||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '7.4', '<')) {
|
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '8.0', '<')) {
|
||||||
$this->setData(['module', $this->getUrl(0), 'config', 'buttonBack', true]);
|
$this->setData(['module', $this->getUrl(0), 'config', 'buttonBack', true]);
|
||||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '7.4']);
|
$this->setData(['module', $this->getUrl(0), 'config', 'showTime', true]);
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'config', 'showDate', true]);
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '8.0']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,7 +580,9 @@ class blog extends common
|
|||||||
'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT, true),
|
'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT, true),
|
||||||
'dateFormat' => $this->getInput('blogOptionDateFormat'),
|
'dateFormat' => $this->getInput('blogOptionDateFormat'),
|
||||||
'timeFormat' => $this->getInput('blogOptionTimeFormat'),
|
'timeFormat' => $this->getInput('blogOptionTimeFormat'),
|
||||||
'buttonBack' => $this->getInput('newsOptionButtonBack'),
|
'buttonBack' => $this->getInput('blogOptionButtonBack', helper::FILTER_BOOLEAN),
|
||||||
|
'showDate' => $this->getInput('blogOptionShowDate', helper::FILTER_BOOLEAN),
|
||||||
|
'showTime' => $this->getInput('blogOptionShowTime', helper::FILTER_BOOLEAN),
|
||||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
|
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
@ -596,7 +600,6 @@ class blog extends common
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suppression
|
* Suppression
|
||||||
*/
|
*/
|
||||||
@ -749,7 +752,7 @@ class blog extends common
|
|||||||
) {
|
) {
|
||||||
// Check la captcha
|
// Check la captcha
|
||||||
if (
|
if (
|
||||||
$this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
$this->isConnected() === false
|
||||||
//AND $this->getInput('blogArticlecaptcha', helper::FILTER_INT) !== $this->getInput('blogArticlecaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('blogArticlecaptchaSecondNumber', helper::FILTER_INT))
|
//AND $this->getInput('blogArticlecaptcha', helper::FILTER_INT) !== $this->getInput('blogArticlecaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('blogArticlecaptchaSecondNumber', helper::FILTER_INT))
|
||||||
and password_verify($this->getInput('blogArticleCaptcha', helper::FILTER_INT), $this->getInput('blogArticleCaptchaResult')) === false
|
and password_verify($this->getInput('blogArticleCaptcha', helper::FILTER_INT), $this->getInput('blogArticleCaptchaResult')) === false
|
||||||
) {
|
) {
|
||||||
@ -831,7 +834,7 @@ class blog extends common
|
|||||||
// Signature de l'article
|
// Signature de l'article
|
||||||
self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
|
self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
|
||||||
// Signature du commentaire édité
|
// Signature du commentaire édité
|
||||||
if ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')) {
|
if ($this->isConnected() === true) {
|
||||||
self::$editCommentSignature = $this->signature($this->getUser('id'));
|
self::$editCommentSignature = $this->signature($this->getUser('id'));
|
||||||
}
|
}
|
||||||
// Commentaires en fonction de la pagination
|
// Commentaires en fonction de la pagination
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
# Versions 7.11
|
# Version 8.00
|
||||||
|
- Ajoute deux nouvelles options pour afficher ou masquer la date et l'heure de l'article.
|
||||||
|
- Corrige un bug d'affichage des articles lorsque le thème Moderne est sélectionné.
|
||||||
|
- Corrige un bug dans la méthode de tronquage de l'article, nécessite Zwii 13.5
|
||||||
|
- Corrige un mauvais format de la propriété buttonBack non stockée au type booléen.
|
||||||
|
# Version 7.11
|
||||||
- Le sélecteur de fichier affiche par défaut le chemin vers le fichier présent dans le champ.
|
- Le sélecteur de fichier affiche par défaut le chemin vers le fichier présent dans le champ.
|
||||||
# Versions 7.10
|
# Version 7.10
|
||||||
- Empêche la validation d'un commentaire lorsque le contenu est vide.
|
- Empêche la validation d'un commentaire lorsque le contenu est vide.
|
||||||
# Versions 7.8 - 7.9
|
# Versions 7.8 - 7.9
|
||||||
- Le flux RSS ne fonctionne pas si les méta de la page sont vides.
|
- Le flux RSS ne fonctionne pas si les méta de la page sont vides.
|
||||||
|
@ -1 +1 @@
|
|||||||
{"name":"blog","realName":"Blog","version":"7.10","update":"0.0","delete":true,"dataDirectory":""}
|
{"name":"blog","realName":"Blog","version":"7.12","update":"0.0","delete":true,"dataDirectory":""}
|
@ -18,14 +18,31 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col6 newsDate textAlignRight">
|
<div class="col6 newsDate textAlignRight">
|
||||||
<!-- bloc signature et date -->
|
<!-- bloc signature -->
|
||||||
<?php echo template::ico('user'); ?>
|
<?php echo template::ico('user'); ?>
|
||||||
<?php echo $module::$articleSignature; ?>
|
<?php echo $module::$articleSignature; ?>
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<!-- bloc date -->
|
||||||
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI) . ' ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
|
<?php if (
|
||||||
|
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||||
|
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
|
||||||
|
): ?>
|
||||||
|
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
|
||||||
|
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (
|
||||||
|
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||||
|
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
|
||||||
|
): ?>
|
||||||
|
<?php echo ' - '; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
|
||||||
|
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
|
||||||
|
<?php endif; ?>
|
||||||
<!-- Bloc edition -->
|
<!-- Bloc edition -->
|
||||||
<?php if (
|
<?php if (
|
||||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
$this->isConnected() === true
|
||||||
and
|
and
|
||||||
( // Propriétaire
|
( // Propriétaire
|
||||||
($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === $module::EDIT_OWNER
|
($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === $module::EDIT_OWNER
|
||||||
@ -88,7 +105,7 @@
|
|||||||
'readonly' => true
|
'readonly' => true
|
||||||
]); ?>
|
]); ?>
|
||||||
<div id="blogArticleCommentWrapper" class="displayNone">
|
<div id="blogArticleCommentWrapper" class="displayNone">
|
||||||
<?php if ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
|
<?php if ($this->isConnected() === true): ?>
|
||||||
<?php echo template::text('blogArticleUserName', [
|
<?php echo template::text('blogArticleUserName', [
|
||||||
'label' => 'Nom',
|
'label' => 'Nom',
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
@ -122,7 +139,7 @@
|
|||||||
'maxlength' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength'])
|
'maxlength' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength'])
|
||||||
]); ?>
|
]); ?>
|
||||||
<div id="blogArticleContentAlarm"> </div>
|
<div id="blogArticleContentAlarm"> </div>
|
||||||
<?php if ($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
|
<?php if ($this->isConnected() === false): ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<?php echo template::captcha('blogArticleCaptcha', [
|
<?php echo template::captcha('blogArticleCaptcha', [
|
||||||
|
@ -24,11 +24,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col6 blogEdit">
|
<div class="col6 blogEdit">
|
||||||
<!-- bloc signature et date -->
|
<!-- bloc signature -->
|
||||||
<?php echo template::ico('user'); ?>
|
<?php echo template::ico('user'); ?>
|
||||||
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
|
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<!-- bloc Date -->
|
||||||
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI) . ' ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
|
<?php if (
|
||||||
|
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||||
|
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
|
||||||
|
): ?>
|
||||||
|
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
|
||||||
|
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (
|
||||||
|
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||||
|
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
|
||||||
|
): ?>
|
||||||
|
<?php echo ' - '; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
|
||||||
|
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -51,7 +68,7 @@
|
|||||||
<div class="col6 blogEdit">
|
<div class="col6 blogEdit">
|
||||||
<!-- Bloc edition -->
|
<!-- Bloc edition -->
|
||||||
<?php if (
|
<?php if (
|
||||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
$this->isConnected() === true
|
||||||
and
|
and
|
||||||
( // Propriétaire
|
( // Propriétaire
|
||||||
($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === $module::EDIT_OWNER
|
($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === $module::EDIT_OWNER
|
||||||
@ -103,18 +120,19 @@
|
|||||||
file_exists(self::FILE_DIR . 'source/' . $article['picture'])
|
file_exists(self::FILE_DIR . 'source/' . $article['picture'])
|
||||||
): ?>
|
): ?>
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php // Déterminer le nom de la miniature
|
<?php
|
||||||
$parts = pathinfo($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']));
|
// Déterminer le nom de la miniature
|
||||||
$thumb = 'mini_' . $parts['basename'];
|
$parts = pathinfo($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']));
|
||||||
// Créer la miniature si manquante
|
$thumb = 'mini_' . $parts['basename'];
|
||||||
if (!file_exists(self::FILE_DIR . 'thumb/' . $thumb)) {
|
// Créer la miniature si manquante
|
||||||
$this->makeThumb(
|
if (!file_exists(self::FILE_DIR . 'thumb/' . $thumb)) {
|
||||||
self::FILE_DIR . 'source/' . $article['picture'],
|
$this->makeThumb(
|
||||||
self::FILE_DIR . 'thumb/' . $thumb,
|
self::FILE_DIR . 'source/' . $article['picture'],
|
||||||
self::THUMBS_WIDTH
|
self::FILE_DIR . 'thumb/' . $thumb,
|
||||||
);
|
self::THUMBS_WIDTH
|
||||||
}
|
);
|
||||||
?>
|
}
|
||||||
|
?>
|
||||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>" class="blogPicture">
|
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>" class="blogPicture">
|
||||||
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb; ?>"
|
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb; ?>"
|
||||||
alt="<?php echo $article['picture']; ?>">
|
alt="<?php echo $article['picture']; ?>">
|
||||||
@ -138,21 +156,43 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="blogDate">
|
<div class="blogDate">
|
||||||
<!-- bloc signature et date -->
|
<!-- bloc signature -->
|
||||||
<?php echo template::ico('user'); ?>
|
<?php echo template::ico('user'); ?>
|
||||||
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
|
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<!-- bloc date -->
|
||||||
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI) . ' ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
|
<?php if (
|
||||||
</div>
|
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||||
<div class="blogContent">
|
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
|
||||||
<?php $lenght = $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) !== 0 ? $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) : 500 ?>
|
): ?>
|
||||||
<?php echo helper::subword(strip_tags($article['content'], '<br><p>'), 0, $lenght); ?>...
|
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
|
||||||
<div class="readMoreContainer">
|
<?php endif; ?>
|
||||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
|
||||||
<button class="readMoreButton">
|
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
|
||||||
<?php echo helper::translate('Lire la suite'); ?>
|
<?php endif; ?>
|
||||||
</button>
|
<?php if (
|
||||||
</a>
|
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||||
|
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
|
||||||
|
): ?>
|
||||||
|
<?php echo ' - '; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
|
||||||
|
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nUI); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="blogContent">
|
||||||
|
<?php $lenght = $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']); ?>
|
||||||
|
<?php if ($lenght > 0): ?>
|
||||||
|
<?php ?>
|
||||||
|
<?php echo helper::subword($article['content'], 0, $lenght); ?>...
|
||||||
|
<div class="readMoreContainer">
|
||||||
|
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">
|
||||||
|
<button class="readMoreButton">
|
||||||
|
<?php echo helper::translate('Lire la suite'); ?>
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php echo $article['content']; ?>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
40
module/blog/view/option/option.js.php
Normal file
40
module/blog/view/option/option.js.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* 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-2024, Frédéric Tempez
|
||||||
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||||
|
* @link http://zwiicms.fr/
|
||||||
|
*/
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
// Gestion du changement de la case "Afficher la date"
|
||||||
|
$('#blogOptionShowDate').change(function() {
|
||||||
|
var showDateChecked = $(this).is(':checked');
|
||||||
|
|
||||||
|
// Afficher ou masquer le wrapper de l'heure selon l'état de la date
|
||||||
|
if (showDateChecked) {
|
||||||
|
$('.timeWrapper').show();
|
||||||
|
} else {
|
||||||
|
$('.timeWrapper').hide();
|
||||||
|
// Désactiver l'option "Afficher l'heure" lorsque la date est désactivée
|
||||||
|
$('#blogOptionShowTime').prop('checked', false).trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Afficher ou masquer le format de la date
|
||||||
|
$('#blogOptionDateFormatWrapper').toggle(showDateChecked);
|
||||||
|
}).trigger('change'); // Déclenchement au chargement de la page
|
||||||
|
|
||||||
|
// Gestion du changement de la case "Afficher l'heure"
|
||||||
|
$('#blogOptionShowTime').change(function() {
|
||||||
|
var showTimeChecked = $(this).is(':checked');
|
||||||
|
|
||||||
|
// Afficher ou masquer le format de l'heure
|
||||||
|
$('#blogOptionTimeFormatWrapper').toggle(showTimeChecked);
|
||||||
|
}).trigger('change'); // Déclenchement au chargement de la page
|
||||||
|
});
|
@ -19,30 +19,22 @@
|
|||||||
</h4>
|
</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::select('blogOptionArticlesLayout', $module::$articlesLayout, [
|
<?php echo template::checkbox('blogOptionShowDate', true, 'Afficher la date', [
|
||||||
'label' => 'Disposition',
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showDate']),
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'layout'])
|
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::select('blogOptionArticlesLenght', $module::$articlesLenght, [
|
|
||||||
'label' => 'Aperçus',
|
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght'])
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
<div class="col2">
|
|
||||||
<?php echo template::select('blogOptionItemsperPage', $module::$ArticlesListed, [
|
|
||||||
'label' => 'Articles par page',
|
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
<div class="col2">
|
|
||||||
<?php echo template::select('blogOptionDateFormat', $module::$dateFormats, [
|
<?php echo template::select('blogOptionDateFormat', $module::$dateFormats, [
|
||||||
'label' => 'Format des dates',
|
'label' => 'Format des dates',
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat'])
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat'])
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col2">
|
<div class="col3 timeWrapper">
|
||||||
|
<?php echo template::checkbox('blogOptionShowTime', true, 'Afficher l\'heure', [
|
||||||
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showTime']),
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col3 timeWrapper">
|
||||||
<?php echo template::select('blogOptionTimeFormat', $module::$timeFormats, [
|
<?php echo template::select('blogOptionTimeFormat', $module::$timeFormats, [
|
||||||
'label' => 'Format des heures',
|
'label' => 'Format des heures',
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat'])
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat'])
|
||||||
@ -50,19 +42,39 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::select('blogOptionArticlesLayout', $module::$articlesLayout, [
|
||||||
|
'label' => 'Disposition',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'layout'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::select('blogOptionArticlesLenght', $module::$articlesLenght, [
|
||||||
|
'label' => 'Aperçus',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::select('blogOptionItemsperPage', $module::$ArticlesListed, [
|
||||||
|
'label' => 'Articles par page',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col3">
|
||||||
|
<?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [
|
||||||
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::checkbox('blogOptionShowFeeds', true, 'Lien du flux RSS', [
|
<?php echo template::checkbox('blogOptionShowFeeds', true, 'Lien du flux RSS', [
|
||||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3">
|
|
||||||
<?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [
|
|
||||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
<div class="col6">
|
<div class="col6">
|
||||||
<?php echo template::text('blogOptionFeedslabel', [
|
<?php echo template::text('blogOptionFeedslabel', [
|
||||||
'label' => 'Texte de l\'étiquette',
|
'label' => 'Texte de l\'étiquette RSS',
|
||||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,8 +27,6 @@ $( document ).ready(function() {
|
|||||||
serializeRegexp: ""
|
serializeRegexp: ""
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log($("#galleryEditSort").val());
|
|
||||||
|
|
||||||
if ($("#galleryEditSort").val() !== "SORT_HAND") {
|
if ($("#galleryEditSort").val() !== "SORT_HAND") {
|
||||||
$("#galleryTable tr").addClass("nodrag nodrop");
|
$("#galleryTable tr").addClass("nodrag nodrop");
|
||||||
$(".zwiico-sort").hide();
|
$(".zwiico-sort").hide();
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
# Versions 6.0
|
||||||
|
- Ajoute deux nouvelles options pour afficher ou masquer la date et l'heure de l'article.
|
||||||
|
- Corrige un mauvais format de la propriété buttonBack non stockée au type booléen.
|
||||||
# Versions 5.9
|
# Versions 5.9
|
||||||
- Largeur d'un bouton de retour.
|
- Largeur d'un bouton de retour.
|
||||||
# Versions 5.7 - 5.8
|
# Versions 5.7 - 5.8
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
class news extends common
|
class news extends common
|
||||||
{
|
{
|
||||||
|
|
||||||
const VERSION = '5.9';
|
const VERSION = '6.0';
|
||||||
const REALNAME = 'News';
|
const REALNAME = 'News';
|
||||||
const DATADIRECTORY = self::DATA_DIR . 'news/';
|
const DATADIRECTORY = self::DATA_DIR . 'news/';
|
||||||
|
|
||||||
@ -124,11 +124,12 @@ class news extends common
|
|||||||
$feeds = new \FeedWriter\RSS2();
|
$feeds = new \FeedWriter\RSS2();
|
||||||
|
|
||||||
// En-tête
|
// En-tête
|
||||||
$feeds->setTitle($this->getData(['page', $this->getUrl(0), 'title']) ? $this->getData(['page', $this->getUrl(0), 'title']): '');
|
$feeds->setTitle($this->getData(['page', $this->getUrl(0), 'title']) ? $this->getData(['page', $this->getUrl(0), 'title']) : '');
|
||||||
$feeds->setLink(helper::baseUrl() . $this->getUrl(0));
|
$feeds->setLink(helper::baseUrl() . $this->getUrl(0));
|
||||||
if ($this->getData(['page', $this->getUrl(0), 'metaDescription'])) {
|
if ($this->getData(['page', $this->getUrl(0), 'metaDescription'])) {
|
||||||
$feeds->setDescription($this->getData(['page', $this->getUrl(0), 'metaDescription']));
|
$feeds->setDescription($this->getData(['page', $this->getUrl(0), 'metaDescription']));
|
||||||
};
|
}
|
||||||
|
;
|
||||||
$feeds->setChannelElement('language', 'fr-FR');
|
$feeds->setChannelElement('language', 'fr-FR');
|
||||||
$feeds->setDate(date('r', time()));
|
$feeds->setDate(date('r', time()));
|
||||||
$feeds->addGenerator();
|
$feeds->addGenerator();
|
||||||
@ -174,7 +175,8 @@ class news extends common
|
|||||||
$publishedOn = $this->getInput('newsAddPublishedOn', helper::FILTER_DATETIME, true);
|
$publishedOn = $this->getInput('newsAddPublishedOn', helper::FILTER_DATETIME, true);
|
||||||
$publishedOff = $this->getInput('newsAddPublishedOff') ? $this->getInput('newsAddPublishedOff', helper::FILTER_DATETIME) : '';
|
$publishedOff = $this->getInput('newsAddPublishedOff') ? $this->getInput('newsAddPublishedOff', helper::FILTER_DATETIME) : '';
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'module', $this->getUrl(0),
|
'module',
|
||||||
|
$this->getUrl(0),
|
||||||
'posts',
|
'posts',
|
||||||
$newsId,
|
$newsId,
|
||||||
[
|
[
|
||||||
@ -288,7 +290,8 @@ class news extends common
|
|||||||
// Fin feuille de style
|
// Fin feuille de style
|
||||||
|
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'module', $this->getUrl(0),
|
'module',
|
||||||
|
$this->getUrl(0),
|
||||||
'theme',
|
'theme',
|
||||||
[
|
[
|
||||||
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '',
|
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '',
|
||||||
@ -300,7 +303,8 @@ class news extends common
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'module', $this->getUrl(0),
|
'module',
|
||||||
|
$this->getUrl(0),
|
||||||
'config',
|
'config',
|
||||||
[
|
[
|
||||||
'feeds' => $this->getInput('newsOptionShowFeeds', helper::FILTER_BOOLEAN),
|
'feeds' => $this->getInput('newsOptionShowFeeds', helper::FILTER_BOOLEAN),
|
||||||
@ -310,7 +314,9 @@ class news extends common
|
|||||||
'height' => $this->getInput('newsOptionHeight', helper::FILTER_INT, true),
|
'height' => $this->getInput('newsOptionHeight', helper::FILTER_INT, true),
|
||||||
'dateFormat' => $this->getInput('newsOptionDateFormat'),
|
'dateFormat' => $this->getInput('newsOptionDateFormat'),
|
||||||
'timeFormat' => $this->getInput('newsOptionTimeFormat'),
|
'timeFormat' => $this->getInput('newsOptionTimeFormat'),
|
||||||
'buttonBack' => $this->getInput('newsOptionButtonBack'),
|
'buttonBack' => $this->getInput('newsOptionButtonBack', helper::FILTER_BOOLEAN),
|
||||||
|
'showDate' => $this->getInput('newsOptionShowDate', helper::FILTER_BOOLEAN),
|
||||||
|
'showTime' => $this->getInput('newsOptionShowTime', helper::FILTER_BOOLEAN),
|
||||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
|
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
@ -318,7 +324,7 @@ class news extends common
|
|||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option',
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||||
'notification' => helper::translate('Modifications enregistrées'),
|
'notification' => helper::translate('Modifications enregistrées'),
|
||||||
'state' => true
|
'state' => true
|
||||||
]);
|
]);
|
||||||
@ -428,7 +434,8 @@ class news extends common
|
|||||||
$publishedOn = $this->getInput('newsEditPublishedOn', helper::FILTER_DATETIME, true);
|
$publishedOn = $this->getInput('newsEditPublishedOn', helper::FILTER_DATETIME, true);
|
||||||
$publishedOff = $this->getInput('newsEditPublishedOff') ? $this->getInput('newsEditPublishedOff', helper::FILTER_DATETIME) : '';
|
$publishedOff = $this->getInput('newsEditPublishedOff') ? $this->getInput('newsEditPublishedOff', helper::FILTER_DATETIME) : '';
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'module', $this->getUrl(0),
|
'module',
|
||||||
|
$this->getUrl(0),
|
||||||
'posts',
|
'posts',
|
||||||
$newsId,
|
$newsId,
|
||||||
[
|
[
|
||||||
@ -490,6 +497,8 @@ class news extends common
|
|||||||
}
|
}
|
||||||
// L'article existe
|
// L'article existe
|
||||||
else {
|
else {
|
||||||
|
self::$dateFormat = $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']);
|
||||||
|
self::$timeFormat = $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']);
|
||||||
self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
|
self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
@ -609,6 +618,14 @@ class news extends common
|
|||||||
// Mettre à jour la version
|
// Mettre à jour la version
|
||||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '5.3']);
|
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '5.3']);
|
||||||
}
|
}
|
||||||
|
// Mise à jour 6.0
|
||||||
|
if (version_compare($versionData, '6.0', '<')) {
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'config', 'buttonBack', true]);
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'config', 'showTime', true]);
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'config', 'showDate', true]);
|
||||||
|
// Mettre à jour la version
|
||||||
|
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '6.0']);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,28 +12,42 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col6 newsDate textAlignRight">
|
<div class="col6 newsDate textAlignRight">
|
||||||
<!-- bloc signature et date -->
|
<!-- bloc signature -->
|
||||||
<?php echo template::ico('user'); ?>
|
<?php echo template::ico('user'); ?>
|
||||||
<?php echo $module::$articleSignature . ' - '; ?>
|
<?php echo $module::$articleSignature; ?>
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<!-- bloc date -->
|
||||||
<?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI) . ' ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
|
|
||||||
<!-- Bloc edition -->
|
|
||||||
<?php if (
|
<?php if (
|
||||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||||
|
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
|
||||||
|
): ?>
|
||||||
|
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
|
||||||
|
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (
|
||||||
|
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||||
|
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
|
||||||
|
): ?>
|
||||||
|
<?php echo ' - '; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
|
||||||
|
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
|
||||||
|
<?php endif; ?> <!-- Bloc edition -->
|
||||||
|
<?php if (
|
||||||
|
$this->isConnected() === true
|
||||||
and
|
and
|
||||||
( // Propriétaire
|
( // Propriétaire
|
||||||
($this->getUser('group') === self::GROUP_ADMIN)
|
($this->getUser('group') === self::GROUP_ADMIN)
|
||||||
)
|
)
|
||||||
): ?>
|
): ?>
|
||||||
-
|
|
||||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1); ?>">
|
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1); ?>">
|
||||||
<?php echo template::ico('pencil'); ?>
|
<?php echo template::ico('pencil', ['margin' => 'left']); ?>
|
||||||
<?php echo helper::translate('Éditer'); ?>
|
<?php echo helper::translate('Éditer'); ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<!-- Bloc RSS-->
|
<!-- Bloc RSS-->
|
||||||
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'feeds'])): ?>
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'feeds'])): ?>
|
||||||
-
|
|
||||||
<div id="rssFeed">
|
<div id="rssFeed">
|
||||||
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>"
|
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>"
|
||||||
target="_blank">
|
target="_blank">
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php if ($module::$news): ?>
|
<?php if ($module::$news): ?>
|
||||||
<link rel="stylesheet" type="text/css" href="<?php echo helper::baseUrl(false) . $this->getData(['module', $this->getUrl(0), 'theme', 'style']);?> "/>
|
<link rel="stylesheet" type="text/css"
|
||||||
|
href="<?php echo helper::baseUrl(false) . $this->getData(['module', $this->getUrl(0), 'theme', 'style']); ?> " />
|
||||||
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'feeds'])): ?>
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'feeds'])): ?>
|
||||||
<div id="rssFeed">
|
<div id="rssFeed">
|
||||||
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>" target="_blank">
|
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>" target="_blank">
|
||||||
@ -20,22 +21,38 @@
|
|||||||
<?php echo '<a href="' . helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?>
|
<?php echo '<a href="' . helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="newsSignature">
|
<div class="newsSignature">
|
||||||
|
<!-- bloc signature -->
|
||||||
<?php echo template::ico('user'); ?>
|
<?php echo template::ico('user'); ?>
|
||||||
<?php echo $news['userId'] . ' - '; ?>
|
<?php echo $news['userId']; ?>
|
||||||
<?php echo template::ico('calendar-empty'); ?>
|
<!-- bloc Date -->
|
||||||
<?php echo helper::dateUTF8($module::$dateFormat, $news['publishedOn'], self::$i18nUI) . ' ' . helper::dateUTF8($module::$timeFormat, $news['publishedOn'], self::$i18nUI); ?>
|
<?php if (
|
||||||
|
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||||
|
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
|
||||||
|
): ?>
|
||||||
|
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
|
||||||
|
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (
|
||||||
|
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||||
|
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
|
||||||
|
): ?>
|
||||||
|
<?php echo ' - '; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
|
||||||
|
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
|
||||||
|
<?php endif; ?>
|
||||||
<!-- Bloc edition -->
|
<!-- Bloc edition -->
|
||||||
<?php if (
|
<?php if (
|
||||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
$this->isConnected() === true
|
||||||
and
|
and
|
||||||
( // Propriétaire
|
( // Propriétaire
|
||||||
($this->getUser('group') === self::GROUP_ADMIN)
|
($this->getUser('group') === self::GROUP_ADMIN)
|
||||||
)
|
)
|
||||||
): ?>
|
): ?>
|
||||||
-
|
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId; ?>">
|
||||||
<a
|
<?php echo template::ico('pencil', ['margin' => 'left']); ?> Éditer
|
||||||
href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId; ?>">
|
|
||||||
<?php echo template::ico('pencil'); ?> Éditer
|
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
@ -51,7 +68,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
<?php echo $module::$pages; ?>
|
<?php echo $module::$pages; ?>
|
||||||
|
40
module/news/view/option/option.js.php
Normal file
40
module/news/view/option/option.js.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* 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-2024, Frédéric Tempez
|
||||||
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||||
|
* @link http://zwiicms.fr/
|
||||||
|
*/
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
// Gestion du changement de la case "Afficher la date"
|
||||||
|
$('#newsOptionShowDate').change(function() {
|
||||||
|
var showDateChecked = $(this).is(':checked');
|
||||||
|
|
||||||
|
// Afficher ou masquer le wrapper de l'heure selon l'état de la date
|
||||||
|
if (showDateChecked) {
|
||||||
|
$('.timeWrapper').show();
|
||||||
|
} else {
|
||||||
|
$('.timeWrapper').hide();
|
||||||
|
// Désactiver l'option "Afficher l'heure" lorsque la date est désactivée
|
||||||
|
$('#newsOptionShowTime').prop('checked', false).trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Afficher ou masquer le format de la date
|
||||||
|
$('#newsOptionDateFormatWrapper').toggle(showDateChecked);
|
||||||
|
}).trigger('change'); // Déclenchement au chargement de la page
|
||||||
|
|
||||||
|
// Gestion du changement de la case "Afficher l'heure"
|
||||||
|
$('#newsOptionShowTime').change(function() {
|
||||||
|
var showTimeChecked = $(this).is(':checked');
|
||||||
|
|
||||||
|
// Afficher ou masquer le format de l'heure
|
||||||
|
$('#newsOptionTimeFormatWrapper').toggle(showTimeChecked);
|
||||||
|
}).trigger('change'); // Déclenchement au chargement de la page
|
||||||
|
});
|
@ -1,111 +1,123 @@
|
|||||||
<?php echo template::formOpen('newsOption'); ?>
|
<?php echo template::formOpen('newsOption'); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col1">
|
<div class="col1">
|
||||||
<?php echo template::button('newsOptionBack', [
|
<?php echo template::button('newsOptionBack', [
|
||||||
'class' => 'buttonGrey',
|
'class' => 'buttonGrey',
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||||
'value' => template::ico('left')
|
'value' => template::ico('left')
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
|
||||||
<div class="col2 offset9">
|
|
||||||
<?php echo template::submit('newsOptionSubmit'); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="col2 offset9">
|
||||||
<div class="col12">
|
<?php echo template::submit('newsOptionSubmit'); ?>
|
||||||
<div class="block">
|
</div>
|
||||||
<h4><?php echo helper::translate('Paramètres'); ?></h4>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col2">
|
<div class="col12">
|
||||||
<?php echo template::select('newsOptionItemsperCol', $module::$columns, [
|
<div class="block">
|
||||||
'label' => 'Nombre de colonnes',
|
<h4><?php echo helper::translate('Paramètres'); ?></h4>
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol'])
|
<div class="row">
|
||||||
]); ?>
|
<div class="col3">
|
||||||
</div>
|
<?php echo template::checkbox('newsOptionShowDate', true, 'Afficher la date', [
|
||||||
<div class="col2">
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showDate']),
|
||||||
<?php echo template::select('newsOptionItemsperPage', $module::$itemsList, [
|
]); ?>
|
||||||
'label' => 'Articles par page',
|
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
<div class="col2">
|
|
||||||
<?php echo template::select('newsOptionHeight', $module::$height, [
|
|
||||||
'label' => 'Abrégé de l\'article',
|
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'height'])
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
<div class="col3">
|
|
||||||
<?php echo template::select('newsOptionDateFormat', $module::$dateFormats, [
|
|
||||||
'label' => 'Format des dates',
|
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat'])
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
<div class="col3">
|
|
||||||
<?php echo template::select('newsOptionTimeFormat', $module::$timeFormats, [
|
|
||||||
'label' => 'Format des heures',
|
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat'])
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="col3">
|
||||||
<div class="col3">
|
<?php echo template::select('newsOptionDateFormat', $module::$dateFormats, [
|
||||||
<?php echo template::checkbox('newsOptionShowFeeds', true, 'Lien du flux RSS', [
|
'label' => 'Format des dates',
|
||||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat'])
|
||||||
'help' => 'Flux limité aux articles de la première page.'
|
]); ?>
|
||||||
]); ?>
|
</div>
|
||||||
</div>
|
<div class="col3 timeWrapper">
|
||||||
<div class="col3">
|
<?php echo template::checkbox('newsOptionShowTime', true, 'Afficher l\'heure', [
|
||||||
<?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showTime']),
|
||||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
|
]); ?>
|
||||||
]); ?>
|
</div>
|
||||||
</div>
|
<div class="col3 timeWrapper">
|
||||||
<div class="col6">
|
<?php echo template::select('newsOptionTimeFormat', $module::$timeFormats, [
|
||||||
<?php echo template::text('newsOptionFeedslabel', [
|
'label' => 'Format des heures',
|
||||||
'label' => 'Étiquette RSS',
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat'])
|
||||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
]); ?>
|
||||||
]); ?>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::select('newsOptionItemsperCol', $module::$columns, [
|
||||||
|
'label' => 'Nombre de colonnes',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperCol'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::select('newsOptionItemsperPage', $module::$itemsList, [
|
||||||
|
'label' => 'Articles par page',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col4">
|
||||||
|
<?php echo template::select('newsOptionHeight', $module::$height, [
|
||||||
|
'label' => 'Abrégé de l\'article',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'height'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col3">
|
||||||
|
<?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [
|
||||||
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col3">
|
||||||
|
<?php echo template::checkbox('newsOptionShowFeeds', true, 'Lien du flux RSS', [
|
||||||
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||||
|
'help' => 'Flux limité aux articles de la première page.'
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col6">
|
||||||
|
<?php echo template::text('newsOptionFeedslabel', [
|
||||||
|
'label' => 'Texte de l\'étiquette RSS',
|
||||||
|
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||||
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
</div>
|
||||||
<div class="col12">
|
<div class="row">
|
||||||
<div class="block">
|
<div class="col12">
|
||||||
<h4><?php echo helper::translate('Thème');?></h4>
|
<div class="block">
|
||||||
<div class="row">
|
<h4><?php echo helper::translate('Thème'); ?></h4>
|
||||||
<div class="col3">
|
<div class="row">
|
||||||
<?php echo template::select('newsThemeBorderStyle', $module::$borderStyle, [
|
<div class="col3">
|
||||||
'label' => 'Bordure',
|
<?php echo template::select('newsThemeBorderStyle', $module::$borderStyle, [
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderStyle'])
|
'label' => 'Bordure',
|
||||||
]); ?>
|
'selected' => $this->getData(['module', $this->getUrl(0), 'theme', 'borderStyle'])
|
||||||
</div>
|
]); ?>
|
||||||
<div class="col3">
|
</div>
|
||||||
<?php echo template::select('newsThemeBorderWidth', $module::$borderWidth, [
|
<div class="col3">
|
||||||
'label' => 'Épaisseur',
|
<?php echo template::select('newsThemeBorderWidth', $module::$borderWidth, [
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderWidth'])
|
'label' => 'Épaisseur',
|
||||||
]); ?>
|
'selected' => $this->getData(['module', $this->getUrl(0), 'theme', 'borderWidth'])
|
||||||
</div>
|
]); ?>
|
||||||
<div class="col3">
|
</div>
|
||||||
<?php echo template::text('newsThemeBorderColor', [
|
<div class="col3">
|
||||||
'class' => 'colorPicker',
|
<?php echo template::text('newsThemeBorderColor', [
|
||||||
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
|
'class' => 'colorPicker',
|
||||||
'label' => 'Couleur de la bordure',
|
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
|
||||||
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'borderColor'])
|
'label' => 'Couleur de la bordure',
|
||||||
]); ?>
|
'value' => $this->getData(['module', $this->getUrl(0), 'theme', 'borderColor'])
|
||||||
</div>
|
]); ?>
|
||||||
<div class="col3">
|
</div>
|
||||||
<?php echo template::text('newsThemeBackgroundColor', [
|
<div class="col3">
|
||||||
'class' => 'colorPicker',
|
<?php echo template::text('newsThemeBackgroundColor', [
|
||||||
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
|
'class' => 'colorPicker',
|
||||||
'label' => 'Couleur du fond',
|
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
|
||||||
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'backgroundColor'])
|
'label' => 'Couleur du fond',
|
||||||
]); ?>
|
'value' => $this->getData(['module', $this->getUrl(0), 'theme', 'backgroundColor'])
|
||||||
</div>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<?php echo template::formClose(); ?>
|
<?php echo template::formClose(); ?>
|
||||||
<div class="moduleVersion">Version n°
|
<div class="moduleVersion">Version n°
|
||||||
<?php echo $module::VERSION; ?>
|
<?php echo $module::VERSION; ?>
|
||||||
|
@ -58,7 +58,7 @@ class redirection extends common
|
|||||||
{
|
{
|
||||||
// Message si l'utilisateur peut éditer la page
|
// Message si l'utilisateur peut éditer la page
|
||||||
if (
|
if (
|
||||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
$this->isConnected() === true
|
||||||
&& $this->getUser('group') >= self::GROUP_EDITOR
|
&& $this->getUser('group') >= self::GROUP_EDITOR
|
||||||
&& $this->getUrl(1) !== 'force'
|
&& $this->getUrl(1) !== 'force'
|
||||||
) {
|
) {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# Version 3.3
|
||||||
|
- Une seule lecture du fichier module.json
|
||||||
# Version 3.2
|
# Version 3.2
|
||||||
- Contrôle de la variable de session liée au contenu. Evite des erreurs lorsque plusieurs onglets sont ouverts.
|
- Contrôle de la variable de session liée au contenu. Evite des erreurs lorsque plusieurs onglets sont ouverts.
|
||||||
# Version 3.1
|
# Version 3.1
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
class search extends common
|
class search extends common
|
||||||
{
|
{
|
||||||
|
|
||||||
const VERSION = '3.2';
|
const VERSION = '3.3';
|
||||||
const REALNAME = 'Recherche';
|
const REALNAME = 'Recherche';
|
||||||
const DATADIRECTORY = self::DATA_DIR . 'search/';
|
const DATADIRECTORY = self::DATA_DIR . 'search/';
|
||||||
|
|
||||||
@ -172,40 +172,43 @@ class search extends common
|
|||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Initialise un module non configuré
|
// Initialise un module non configuré
|
||||||
$this->init();
|
$this->init();
|
||||||
|
|
||||||
if (
|
if ($this->isPost()) {
|
||||||
$this->isPost()
|
|
||||||
) {
|
|
||||||
//Initialisations variables
|
//Initialisations variables
|
||||||
$success = true;
|
$success = true;
|
||||||
$result = [];
|
$result = [];
|
||||||
$notification = '';
|
$notification = '';
|
||||||
$total = '';
|
$total = '';
|
||||||
|
|
||||||
// Récupération du mot clef passé par le formulaire de ...view/index.php, avec caractères accentués
|
// Récupération du mot clef passé par le formulaire de ...view/index.php, avec caractères accentués
|
||||||
self::$motclef = $this->getInput('searchMotphraseclef');
|
self::$motclef = $this->getInput('searchMotphraseclef');
|
||||||
// Variable de travail, on conserve la variable globale pour l'affichage du résultat
|
// Variable de travail, on conserve la variable globale pour l'affichage du résultat
|
||||||
$motclef = self::$motclef;
|
$motclef = self::$motclef;
|
||||||
|
|
||||||
// Suppression des mots < 3 caractères et des articles > 2 caractères de la chaîne $motclef
|
// Suppression des mots < 3 caractères et des articles > 2 caractères de la chaîne $motclef
|
||||||
$arraymotclef = explode(' ', $motclef);
|
$arraymotclef = explode(' ', $motclef);
|
||||||
$motclef = '';
|
$motclef = '';
|
||||||
foreach ($arraymotclef as $key => $value) {
|
foreach ($arraymotclef as $key => $value) {
|
||||||
if (strlen($value) > 2 && $value !== 'les' && $value !== 'des' && $value !== 'une' && $value !== 'aux')
|
if (strlen($value) > 2 && $value !== 'les' && $value !== 'des' && $value !== 'une' && $value !== 'aux') {
|
||||||
$motclef .= $value . ' ';
|
$motclef .= $value . ' ';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Suppression du dernier ' '
|
// Suppression du dernier ' '
|
||||||
if ($motclef !== '')
|
if ($motclef !== '') {
|
||||||
$motclef = substr($motclef, 0, strlen($motclef) - 1);
|
$motclef = substr($motclef, 0, strlen($motclef) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Récupération de l'état de l'option mot entier passé par le même formulaire
|
// Récupération de l'état de l'option mot entier passé par le même formulaire
|
||||||
self::$motentier = $this->getInput('searchMotentier', helper::FILTER_BOOLEAN);
|
self::$motentier = $this->getInput('searchMotentier', helper::FILTER_BOOLEAN);
|
||||||
|
|
||||||
|
// Lecture unique des données du module
|
||||||
|
$moduleData = $this->getData(['module']);
|
||||||
|
|
||||||
if ($motclef !== '') {
|
if ($motclef !== '') {
|
||||||
foreach ($this->getHierarchy(null, false, null) as $parentId => $childIds) {
|
foreach ($this->getHierarchy(null, false, null) as $parentId => $childIds) {
|
||||||
|
// Vérification des conditions pour la page parente
|
||||||
if (
|
if (
|
||||||
$this->getData(['page', $parentId, 'disable']) === false &&
|
$this->getData(['page', $parentId, 'disable']) === false &&
|
||||||
$this->getUser('group') >= $this->getData(['page', $parentId, 'group']) &&
|
$this->getUser('group') >= $this->getData(['page', $parentId, 'group']) &&
|
||||||
@ -213,7 +216,6 @@ class search extends common
|
|||||||
) {
|
) {
|
||||||
$url = $parentId;
|
$url = $parentId;
|
||||||
$titre = $this->getData(['page', $parentId, 'title']);
|
$titre = $this->getData(['page', $parentId, 'title']);
|
||||||
//$content = file_get_contents(self::DATA_DIR . self::$siteContent . '/content/' . $this->getData(['page', $parentId, 'content']));
|
|
||||||
$content = $this->getPage($parentId, self::$siteContent);
|
$content = $this->getPage($parentId, self::$siteContent);
|
||||||
$content = $titre . ' ' . $content;
|
$content = $titre . ' ' . $content;
|
||||||
// Pages sauf pages filles et articles de blog
|
// Pages sauf pages filles et articles de blog
|
||||||
@ -222,9 +224,9 @@ class search extends common
|
|||||||
$result[] = $tempData;
|
$result[] = $tempData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Vérification des sous-pages et articles de sous-pages
|
||||||
foreach ($childIds as $childId) {
|
foreach ($childIds as $childId) {
|
||||||
// Sous page
|
|
||||||
if (
|
if (
|
||||||
$this->getData(['page', $childId, 'disable']) === false &&
|
$this->getData(['page', $childId, 'disable']) === false &&
|
||||||
$this->getUser('group') >= $this->getData(['page', $parentId, 'group']) &&
|
$this->getUser('group') >= $this->getData(['page', $parentId, 'group']) &&
|
||||||
@ -232,24 +234,21 @@ class search extends common
|
|||||||
) {
|
) {
|
||||||
$url = $childId;
|
$url = $childId;
|
||||||
$titre = $this->getData(['page', $childId, 'title']);
|
$titre = $this->getData(['page', $childId, 'title']);
|
||||||
//$content = file_get_contents(self::DATA_DIR . self::$siteContent . '/content/' . $this->getData(['page', $childId, 'content']));
|
|
||||||
$content = $this->getPage($childId, self::$siteContent);
|
$content = $this->getPage($childId, self::$siteContent);
|
||||||
$content = $titre . ' ' . $content;
|
$content = $titre . ' ' . $content;
|
||||||
//Pages filles
|
|
||||||
$tempData = $this->occurrence($url, $titre, $content, $motclef, self::$motentier);
|
$tempData = $this->occurrence($url, $titre, $content, $motclef, self::$motentier);
|
||||||
if (is_array($tempData)) {
|
if (is_array($tempData)) {
|
||||||
$result[] = $tempData;
|
$result[] = $tempData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Articles d'une sous-page blog ou de news
|
// Articles d'une sous-page blog ou de news
|
||||||
if ($this->getData(['module', $childId, 'posts'])) {
|
if (isset($moduleData[$childId]['posts'])) {
|
||||||
foreach ($this->getData(['module', $childId, 'posts']) as $articleId => $article) {
|
foreach ($moduleData[$childId]['posts'] as $articleId => $article) {
|
||||||
if ($this->getData(['module', $childId, 'posts', $articleId, 'state']) === true) {
|
if ($article['state'] === true) {
|
||||||
$url = $childId . '/' . $articleId;
|
$url = $childId . '/' . $articleId;
|
||||||
$titre = $article['title'];
|
$titre = $article['title'];
|
||||||
$contenu = ' ' . $titre . ' ' . $article['content'];
|
$contenu = ' ' . $titre . ' ' . $article['content'];
|
||||||
// Articles de sous-page de type blog
|
|
||||||
$tempData = $this->occurrence($url, $titre, $contenu, $motclef, self::$motentier);
|
$tempData = $this->occurrence($url, $titre, $contenu, $motclef, self::$motentier);
|
||||||
if (is_array($tempData)) {
|
if (is_array($tempData)) {
|
||||||
$result[] = $tempData;
|
$result[] = $tempData;
|
||||||
@ -258,12 +257,11 @@ class search extends common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Articles d'un blog ou de news
|
// Articles d'un blog ou de news
|
||||||
if ($this->getData(['module', $parentId, 'posts'])) {
|
if (isset($moduleData[$parentId]['posts'])) {
|
||||||
|
foreach ($moduleData[$parentId]['posts'] as $articleId => $article) {
|
||||||
foreach ($this->getData(['module', $parentId, 'posts']) as $articleId => $article) {
|
if ($article['state'] === true) {
|
||||||
if ($this->getData(['module', $parentId, 'posts', $articleId, 'state']) === true) {
|
|
||||||
$url = $parentId . '/' . $articleId;
|
$url = $parentId . '/' . $articleId;
|
||||||
$titre = $article['title'];
|
$titre = $article['title'];
|
||||||
$contenu = ' ' . $titre . ' ' . $article['content'];
|
$contenu = ' ' . $titre . ' ' . $article['content'];
|
||||||
@ -275,22 +273,21 @@ class search extends common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message de synthèse de la recherche
|
// Message de synthèse de la recherche
|
||||||
if (count($result) === 0) {
|
if (count($result) === 0) {
|
||||||
self::$resultTitle = helper::translate('Aucun résultat');
|
self::$resultTitle = helper::translate('Aucun résultat');
|
||||||
self::$resultError = helper::translate('Avez-vous pensé aux accents ?');
|
self::$resultError = helper::translate('Avez-vous pensé aux accents ?');
|
||||||
} else {
|
} else {
|
||||||
self::$resultError = '';
|
self::$resultError = '';
|
||||||
//self::$resultTitle = sprintf(' %s',helper::translate('Résultat de votre recherche'));
|
|
||||||
rsort($result);
|
rsort($result);
|
||||||
foreach ($result as $key => $value) {
|
foreach ($result as $key => $value) {
|
||||||
$r[] = $value['preview'];
|
$r[] = $value['preview'];
|
||||||
}
|
}
|
||||||
// Générer une chaine de caractères
|
|
||||||
self::$resultList = implode("", $r);
|
self::$resultList = implode("", $r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valeurs en sortie, affichage du résultat
|
// Valeurs en sortie, affichage du résultat
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'view' => 'index',
|
'view' => 'index',
|
||||||
@ -309,6 +306,8 @@ class search extends common
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Fonction de recherche des occurrences dans $contenu
|
// Fonction de recherche des occurrences dans $contenu
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
# Version 2.3
|
||||||
|
- Warning lors de la saisie d'un email vide
|
||||||
|
# Version 2.2
|
||||||
|
- Ajoute la gestion des profils
|
||||||
|
# Version 2.1
|
||||||
|
- N'envoie pas d'email lorsque le domaine est invalide.
|
||||||
|
- Corrige la validation de domaines multiples séparés par des points virgules.
|
||||||
|
# Version 2.0
|
||||||
|
- trop de corrections.
|
@ -1 +1 @@
|
|||||||
{"name":"suscribe","realName":"Auto inscription","version":"2.00","update":"0.0","delete":true,"dataDirectory":""}
|
{"name":"suscribe","realName":"Auto Inscription","version":"2.3","update":"0.0","delete":true,"dataDirectory":""}
|
@ -1,9 +1,9 @@
|
|||||||
<?php $moduleData['suscribe'] = [
|
<?php $moduleData['suscribe'] = [
|
||||||
'edit' => $this->getInput('profilAddSuscribeEdit', helper::FILTER_BOOLEAN),
|
'edit' => $this->getInput('profilAddSuscribeEdit', helper::FILTER_BOOLEAN),
|
||||||
'delete' => $this->getInput('profilAddSuscribeDelete', helper::FILTER_BOOLEAN),
|
'delete' => $this->getInput('profilAddSuscribeDelete', helper::FILTER_BOOLEAN),
|
||||||
'user' => $this->getInput('profilAddSuscribeUser', helper::FILTER_BOOLEAN),
|
'user' => $this->getInput('profilAddSuscribeUser', helper::FILTER_BOOLEAN),
|
||||||
'config' => $this->getInput('profilAddSuscribeAdd', helper::FILTER_BOOLEAN) ||
|
'config' => $this->getInput('profilAddSuscribeAdd', helper::FILTER_BOOLEAN) ||
|
||||||
$this->getInput('profilAddSuscribeEdit', helper::FILTER_BOOLEAN) ||
|
$this->getInput('profilAddSuscribeEdit', helper::FILTER_BOOLEAN) ||
|
||||||
$this->getInput('profilAddSuscribeDelete', helper::FILTER_BOOLEAN) ||
|
$this->getInput('profilAddSuscribeDelete', helper::FILTER_BOOLEAN) ||
|
||||||
$this->getInput('profilAddSuscribeUser', helper::FILTER_BOOLEAN)
|
$this->getInput('profilAddSuscribeUser', helper::FILTER_BOOLEAN)
|
||||||
];
|
];
|
@ -1,9 +1,9 @@
|
|||||||
<?php $moduleData['suscribe'] = [
|
<?php $moduleData['suscribe'] = [
|
||||||
'edit' => $this->getInput('profilEditSuscribeEdit', helper::FILTER_BOOLEAN),
|
'edit' => $this->getInput('profilEditSuscribeEdit', helper::FILTER_BOOLEAN),
|
||||||
'delete' => $this->getInput('profilEditSuscribeDelete', helper::FILTER_BOOLEAN),
|
'delete' => $this->getInput('profilEditSuscribeDelete', helper::FILTER_BOOLEAN),
|
||||||
'user' => $this->getInput('profilEditSuscribeUser', helper::FILTER_BOOLEAN),
|
'user' => $this->getInput('profilEditSuscribeUser', helper::FILTER_BOOLEAN),
|
||||||
'config' => $this->getInput('profilEditSuscribeAdd', helper::FILTER_BOOLEAN) ||
|
'config' => $this->getInput('profilEditSuscribeAdd', helper::FILTER_BOOLEAN) ||
|
||||||
$this->getInput('profilEditSuscribeEdit', helper::FILTER_BOOLEAN) ||
|
$this->getInput('profilEditSuscribeEdit', helper::FILTER_BOOLEAN) ||
|
||||||
$this->getInput('profilEditSuscribeDelete', helper::FILTER_BOOLEAN) ||
|
$this->getInput('profilEditSuscribeDelete', helper::FILTER_BOOLEAN) ||
|
||||||
$this->getInput('profilEditSuscribeUser', helper::FILTER_BOOLEAN)
|
$this->getInput('profilEditSuscribeUser', helper::FILTER_BOOLEAN)
|
||||||
];
|
];
|
@ -1,20 +1,20 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>
|
<h4>
|
||||||
<?php echo sprintf('%s %s', helper::translate('Permissions'), helper::translate('Auto-inscription')); ?>
|
<?php echo sprintf('%s %s', helper::translate('Permissions'), helper::translate('Auto-inscription')); ?>
|
||||||
</h4>
|
</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::checkbox('profilAddSuscribeEdit', true, 'Éditer inscription'); ?>
|
<?php echo template::checkbox('profilAddSuscribeEdit', true, 'Éditer inscription'); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::checkbox('profilAddSuscribeDelete', true, 'Effacer inscription'); ?>
|
<?php echo template::checkbox('profilAddSuscribeDelete', true, 'Effacer inscription'); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::checkbox('profilAddSuscribeUser', true, 'Valider inscriptions'); ?>
|
<?php echo template::checkbox('profilAddSuscribeUser', true, 'Valider inscriptions'); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -1,26 +1,26 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>
|
<h4>
|
||||||
<?php echo sprintf('%s %s', helper::translate('Permissions'), helper::translate('Auto-inscription')); ?>·
|
<?php echo sprintf('%s %s', helper::translate('Permissions'), helper::translate('Auto-inscription')); ?>·
|
||||||
</h4>
|
</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::checkbox('profilEditSuscribeEdit', true, 'Éditer inscription', [
|
<?php echo template::checkbox('profilEditSuscribeEdit', true, 'Éditer inscription', [
|
||||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'suscribe', 'edit'])
|
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'suscribe', 'edit'])
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::checkbox('profilEditSuscribeDelete', true, 'Effacer inscription', [
|
<?php echo template::checkbox('profilEditSuscribeDelete', true, 'Effacer inscription', [
|
||||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'suscribe', 'delete'])
|
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'suscribe', 'delete'])
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::checkbox('profilEditSuscribeUser', true, 'Valider inscriptions', [
|
<?php echo template::checkbox('profilEditSuscribeUser', true, 'Valider inscriptions', [
|
||||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'suscribe', 'user'])
|
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'suscribe', 'user'])
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -1,487 +1,503 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file is part of Zwii.
|
* This file is part of Zwii.
|
||||||
*
|
*
|
||||||
* For full copyright and license information, please see the LICENSE
|
* For full copyright and license information, please see the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||||
* @link http://zwiicms.com/
|
* @link http://zwiicms.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class suscribe extends common
|
class suscribe extends common
|
||||||
{
|
{
|
||||||
|
|
||||||
const VERSION = '2.0';
|
const VERSION = '2.3';
|
||||||
const REALNAME = 'Auto Inscription';
|
const REALNAME = 'Auto Inscription';
|
||||||
const DELETE = true;
|
const DELETE = true;
|
||||||
const UPDATE = '0.0';
|
const UPDATE = '0.0';
|
||||||
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
|
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
|
||||||
|
|
||||||
const STATUS_EMAIL_AWAITING = 0;
|
const STATUS_EMAIL_AWAITING = 0;
|
||||||
const STATUS_EMAIL_VALID = 1;
|
const STATUS_EMAIL_VALID = 1;
|
||||||
const STATUS_ACCOUNT_AWAITING = 2;
|
const STATUS_ACCOUNT_AWAITING = 2;
|
||||||
const STATUS_ACCOUNT_VALID = 3;
|
const STATUS_ACCOUNT_VALID = 3;
|
||||||
public static $statusGroups = [
|
public static $statusGroups = [
|
||||||
self::STATUS_EMAIL_AWAITING => 'Email non confirmé',
|
self::STATUS_EMAIL_AWAITING => 'Email non confirmé',
|
||||||
self::STATUS_EMAIL_VALID => 'Email valide',
|
self::STATUS_EMAIL_VALID => 'Email valide',
|
||||||
self::STATUS_ACCOUNT_AWAITING => 'Email valide, en attente de confirmation',
|
self::STATUS_ACCOUNT_AWAITING => 'Email valide, en attente de confirmation',
|
||||||
self::STATUS_ACCOUNT_VALID => 'Email valide, compte activé',
|
self::STATUS_ACCOUNT_VALID => 'Email valide, compte activé',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $actions = [
|
public static $actions = [
|
||||||
'index' => self::GROUP_VISITOR,
|
'index' => self::GROUP_VISITOR,
|
||||||
'validate' => self::GROUP_VISITOR,
|
'validate' => self::GROUP_VISITOR,
|
||||||
'config' => self::GROUP_EDITOR,
|
'config' => self::GROUP_EDITOR,
|
||||||
'users' => self::GROUP_EDITOR,
|
'users' => self::GROUP_EDITOR,
|
||||||
'delete' => self::GROUP_EDITOR,
|
'delete' => self::GROUP_EDITOR,
|
||||||
'edit' => self::GROUP_EDITOR
|
'edit' => self::GROUP_EDITOR
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $layout = [
|
public static $layout = [
|
||||||
'inputRowContainer1' => 'Un élément par ligne',
|
'inputRowContainer1' => 'Un élément par ligne',
|
||||||
'inputRowContainer2' => 'Deux éléments par ligne',
|
'inputRowContainer2' => 'Deux éléments par ligne',
|
||||||
'inputRowContainer4' => 'Quatre éléments par ligne',
|
'inputRowContainer4' => 'Quatre éléments par ligne',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $timeLimit = [
|
public static $timeLimit = [
|
||||||
2 => '2 minutes',
|
2 => '2 minutes',
|
||||||
5 => '5 minutes',
|
5 => '5 minutes',
|
||||||
10 => '10 minutes'
|
10 => '10 minutes'
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $users = [];
|
public static $users = [];
|
||||||
|
|
||||||
public static $groups = [];
|
public static $groups = [];
|
||||||
public static $userProfils = [];
|
public static $userProfils = [];
|
||||||
public static $userProfilsComments = [];
|
public static $userProfilsComments = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Liste des utilisateurs en attente
|
* Liste des utilisateurs en attente
|
||||||
*/
|
*/
|
||||||
public function users()
|
public function users()
|
||||||
{
|
{
|
||||||
$userIdsFirstnames = helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'users']), 'firstname');
|
$userIdsFirstnames = helper::arraycollumn($this->getData(['module', $this->getUrl(0), 'users']), 'firstname');
|
||||||
ksort($userIdsFirstnames);
|
ksort($userIdsFirstnames);
|
||||||
foreach ($userIdsFirstnames as $userId => $userFirstname) {
|
foreach ($userIdsFirstnames as $userId => $userFirstname) {
|
||||||
self::$users[] = [
|
self::$users[] = [
|
||||||
$userId,
|
$userId,
|
||||||
$userFirstname . ' ' . $this->getData(['module', $this->getUrl(0), 'users', $userId, 'lastname']),
|
$userFirstname . ' ' . $this->getData(['module', $this->getUrl(0), 'users', $userId, 'lastname']),
|
||||||
self::$statusGroups[$this->getData(['module', $this->getUrl(0), 'users', $userId, 'status'])],
|
self::$statusGroups[$this->getData(['module', $this->getUrl(0), 'users', $userId, 'status'])],
|
||||||
helper::dateUTF8(date('Y-m-d G:i'), $this->getData(['module', $this->getUrl(0), 'users', $userId, 'timer'])),
|
helper::dateUTF8(date('Y-m-d G:i'), $this->getData(['module', $this->getUrl(0), 'users', $userId, 'timer'])),
|
||||||
template::button('registrationUserEdit' . $userId, [
|
template::button('registrationUserEdit' . $userId, [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $userId,
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $userId,
|
||||||
'value' => template::ico('pencil')
|
'value' => template::ico('pencil')
|
||||||
]),
|
]),
|
||||||
template::button('registrationUserDelete' . $userId, [
|
template::button('registrationUserDelete' . $userId, [
|
||||||
'class' => 'userDelete red',
|
'class' => 'userDelete red',
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $userId,
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $userId,
|
||||||
'value' => template::ico('cancel')
|
'value' => template::ico('cancel')
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => 'Inscription en attente',
|
'title' => 'Inscription en attente',
|
||||||
'view' => 'users'
|
'view' => 'users'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Édition
|
* Édition
|
||||||
*/
|
*/
|
||||||
public function edit()
|
public function edit()
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||||
) {
|
) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'access' => false
|
'access' => false
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
// Accès refusé
|
// Accès refusé
|
||||||
if (
|
if (
|
||||||
// L'utilisateur n'existe pas
|
// L'utilisateur n'existe pas
|
||||||
$this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2)]) === null
|
$this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2)]) === null
|
||||||
// Droit d'édition
|
// Droit d'édition
|
||||||
and (
|
and (
|
||||||
// Impossible de s'auto-éditer
|
// Impossible de s'auto-éditer
|
||||||
(
|
(
|
||||||
$this->getUser('id') === 'user'
|
$this->getUser('id') === 'user'
|
||||||
and $this->getUrl('group') <= self::GROUP_VISITOR
|
and $this->getUrl('group') <= self::GROUP_VISITOR
|
||||||
)
|
)
|
||||||
// Impossible d'éditer un autre utilisateur
|
// Impossible d'éditer un autre utilisateur
|
||||||
or ($this->getUrl('group') < self::GROUP_EDITOR)
|
or ($this->getUrl('group') < self::GROUP_EDITOR)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'access' => false
|
'access' => false
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
// Accès autorisé
|
// Accès autorisé
|
||||||
else {
|
else {
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if (
|
if (
|
||||||
$this->getUser('permission', __CLASS__, __FUNCTION__) === true
|
$this->getUser('permission', __CLASS__, __FUNCTION__) === true
|
||||||
&& $this->isPost()
|
&& $this->isPost()
|
||||||
) {
|
) {
|
||||||
// Créer le user dans la base
|
// Créer le user dans la base
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'user',
|
'user',
|
||||||
$this->getUrl(2),
|
$this->getUrl(2),
|
||||||
[
|
[
|
||||||
'firstname' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'firstname']),
|
'firstname' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'firstname']),
|
||||||
'forgot' => 0,
|
'forgot' => 0,
|
||||||
'group' => $this->getInput('registrationUserEditGroup', helper::FILTER_INT),
|
'group' => $this->getInput('registrationUserEditGroup', helper::FILTER_INT),
|
||||||
// Le profil vaut 0 pour les amdins et 1 pour les autres membres, profil par défaut.
|
// Le profil vaut 0 pour les amdins et 1 pour les autres membres, profil par défaut.
|
||||||
'profil' => $this->getInput('registrationUserEditGroup', helper::FILTER_INT) === self::GROUP_ADMIN
|
'profil' => $this->getInput('registrationUserEditGroup', helper::FILTER_INT) === self::GROUP_ADMIN
|
||||||
? 0 : 1,
|
? 0 : 1,
|
||||||
'lastname' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'lastname']),
|
'lastname' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'lastname']),
|
||||||
'mail' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'mail']),
|
'mail' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'mail']),
|
||||||
'password' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'password']),
|
'password' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'password']),
|
||||||
'tags' => $this->getInput('registrationUserLabel', helper::FILTER_STRING_SHORT),
|
'tags' => $this->getInput('registrationUserLabel', helper::FILTER_STRING_SHORT),
|
||||||
'connectFail' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'connectFail']),
|
'connectFail' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'connectFail']),
|
||||||
'connectTimeout' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'connectTimeout']),
|
'connectTimeout' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'connectTimeout']),
|
||||||
'accessUrl' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'accessUrl']),
|
'accessUrl' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'accessUrl']),
|
||||||
'accessTimer' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'accessTimer']),
|
'accessTimer' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'accessTimer']),
|
||||||
'accessCsrf' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'accessCsrf'])
|
'accessCsrf' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'accessCsrf'])
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
// Notifier le user uniquement si le groupe est membre au moins membre
|
// Notifier le user uniquement si le groupe est membre au moins membre
|
||||||
if ($this->getInput('registrationUserEditGroup') >= 1) {
|
if ($this->getInput('registrationUserEditGroup') >= 1) {
|
||||||
$this->sendMail(
|
$this->sendMail(
|
||||||
$this->getData(['module', $this->getUrl(0), 'users', 'mail']),
|
$this->getData(['module', $this->getUrl(0), 'users', 'mail']),
|
||||||
'Approbation de l\'inscription',
|
'Approbation de l\'inscription',
|
||||||
'<p>' . $this->getdata(['module', $this->getUrl(0), 'config', 'mailValidateContent']) . '</p>',
|
'<p>' . $this->getdata(['module', $this->getUrl(0), 'config', 'mailValidateContent']) . '</p>',
|
||||||
null,
|
null,
|
||||||
$this->getData(['config', 'smtp', 'from'])
|
$this->getData(['config', 'smtp', 'from'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Supprimer le user de la base temporaire,
|
// Supprimer le user de la base temporaire,
|
||||||
$this->deleteData(['module', $this->getUrl(0), 'users', $this->getUrl(2)]);
|
$this->deleteData(['module', $this->getUrl(0), 'users', $this->getUrl(2)]);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/users',
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/users',
|
||||||
'notification' => 'Modifications enregistrées',
|
'notification' => 'Modifications enregistrées',
|
||||||
'state' => true
|
'state' => true
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
// Changement temporaire de libellé du groupe 0
|
// Changement temporaire de libellé du groupe 0
|
||||||
self::$groups = self::$groupEdits;
|
self::$groups = self::$groupEdits;
|
||||||
self::$groups[self::GROUP_BANNED] = 'En attente d\'approbation';
|
self::$groups[self::GROUP_BANNED] = 'En attente d\'approbation';
|
||||||
|
|
||||||
// Profils disponibles
|
// Profils disponibles
|
||||||
foreach ($this->getData(['profil']) as $profilId => $profilData) {
|
foreach ($this->getData(['profil']) as $profilId => $profilData) {
|
||||||
if ($profilId < self::GROUP_MEMBER) {
|
if ($profilId < self::GROUP_MEMBER) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($profilId === self::GROUP_ADMIN) {
|
if ($profilId === self::GROUP_ADMIN) {
|
||||||
self::$userProfils[$profilId][self::GROUP_ADMIN] = $profilData['name'];
|
self::$userProfils[$profilId][self::GROUP_ADMIN] = $profilData['name'];
|
||||||
self::$userProfilsComments[$profilId][self::GROUP_ADMIN] = $profilData['comment'];
|
self::$userProfilsComments[$profilId][self::GROUP_ADMIN] = $profilData['comment'];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach ($profilData as $key => $value) {
|
foreach ($profilData as $key => $value) {
|
||||||
self::$userProfils[$profilId][$key] = $profilData[$key]['name'];
|
self::$userProfils[$profilId][$key] = $profilData[$key]['name'];
|
||||||
self::$userProfilsComments[$profilId][$key] = $profilData[$key]['name'] . ' : ' . $profilData[$key]['comment'];
|
self::$userProfilsComments[$profilId][$key] = $profilData[$key]['name'] . ' : ' . $profilData[$key]['comment'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => $this->getData(['module', $this->getUrl(0), 'users', 'firstname']) . ' ' . $this->getData(['user', $this->getUrl(0), 'lastname']),
|
'title' => $this->getData(['module', $this->getUrl(0), 'users', 'firstname']) . ' ' . $this->getData(['user', $this->getUrl(0), 'lastname']),
|
||||||
'view' => 'edit'
|
'view' => 'edit'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suppression
|
* Suppression
|
||||||
*/
|
*/
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
// Accès refusé
|
// Accès refusé
|
||||||
if (
|
if (
|
||||||
// L'utilisateur n'existe pas
|
// L'utilisateur n'existe pas
|
||||||
$this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2)]) === null
|
$this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2)]) === null
|
||||||
// Groupe insuffisant
|
// Groupe insuffisant
|
||||||
&& $this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
&& $this->getUser('permission', __CLASS__, __FUNCTION__) !== true
|
||||||
) {
|
) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'access' => false
|
'access' => false
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
// Suppression
|
// Suppression
|
||||||
else {
|
else {
|
||||||
$this->deleteData(['module', $this->getUrl(0), 'users', $this->getUrl(2)]);
|
$this->deleteData(['module', $this->getUrl(0), 'users', $this->getUrl(2)]);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/users',
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/users',
|
||||||
'notification' => 'Utilisateur supprimé',
|
'notification' => 'Utilisateur supprimé',
|
||||||
'state' => true
|
'state' => true
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajout
|
* Ajout
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Traitement du formulaire
|
* Traitement du formulaire
|
||||||
* Stocke les données du formulaire dans le module
|
* Stocke les données du formulaire dans le module
|
||||||
* Envoie le mail de vérification de l'email
|
* Envoie le mail de vérification de l'email
|
||||||
*/
|
*/
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if ($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
// Le domaine saisi est invalide si un filtre existe
|
// Contrôler la validité du domaine saisi parmi les domaines valides
|
||||||
if (
|
$email_to_check = $this->getInput('registrationAddMail', helper::FILTER_MAIL, true);
|
||||||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'filter']))
|
// Le domaine saisi est invalide si un filtre existe
|
||||||
) {
|
if (
|
||||||
// Contrôler la validité du domaine saisi parmi les domaines valides
|
empty($this->getData(['module', $this->getUrl(0), 'config', 'filter'])) === true &&
|
||||||
$email_to_check = $this->getInput('registrationAddMail', helper::FILTER_MAIL, true);
|
empty($email_to_check) === true
|
||||||
$valid_domains[] = strpos($this->getData(['module', $this->getUrl(0), 'config', 'filter']), ';') === false
|
) {
|
||||||
? $this->getData(['module', $this->getUrl(0), 'config', 'filter'])
|
|
||||||
: explode(';', $this->getData(['module', $this->getUrl(0), 'config', 'filter']));
|
|
||||||
if (in_array(explode('@', $email_to_check)[1], $valid_domains) === false) {
|
// Récupérer la liste des domaines valides depuis la configuration et supprimer les espaces autour
|
||||||
self::$inputNotices['registrationAddMail'] = 'Ce domaine n\'est pas autorisé';
|
$filter = trim($this->getData(['module', $this->getUrl(0), 'config', 'filter']));
|
||||||
}
|
|
||||||
}
|
// Vérifier si la liste contient plusieurs domaines ou un seul, puis supprimer les espaces pour chaque domaine
|
||||||
// Drapeau de contrôle des données saisies.
|
$valid_domains = strpos($filter, ';') === false
|
||||||
$check = true;
|
? [trim($filter)] // Si un seul domaine, on supprime les espaces et on le met dans un tableau
|
||||||
$sentMailtoUser = false;
|
: array_map('trim', explode(';', $filter)); // Si plusieurs domaines, on les explose en tableau et supprime les espaces
|
||||||
// L'identifiant d'utilisateur est indisponible
|
|
||||||
$userId = $this->getInput('registrationAddId', helper::FILTER_ID, true);
|
// Extraire le domaine de l'adresse email à vérifier
|
||||||
if (is_array($this->getData(['user', $userId]))) {
|
$email_domain = explode('@', $email_to_check)[1];
|
||||||
self::$inputNotices['registrationAddId'] = 'Identifiant invalide';
|
|
||||||
$check = false;
|
// Vérifier si le domaine de l'email est dans la liste des domaines valides
|
||||||
}
|
if (!in_array($email_domain, $valid_domains)) {
|
||||||
// Le compte existe déjà
|
self::$inputNotices['registrationAddMail'] = 'Ce domaine n\'est pas autorisé';
|
||||||
foreach ($this->getData(['user']) as $usersId => $user) {
|
}
|
||||||
if ($user['mail'] === $this->getInput('registrationAddMail', helper::FILTER_MAIL, true)) {
|
|
||||||
self::$inputNotices['registrationAddMail'] = 'Vous ne pouvez pas utilisez cette boite mail';
|
}
|
||||||
$check = false;
|
// Email valide, on continue le traitement
|
||||||
break;
|
if (self::$inputNotices === []) {
|
||||||
}
|
// Drapeau de contrôle des données saisies.
|
||||||
}
|
$check = true;
|
||||||
// Données de l'utilisateur
|
$sentMailtoUser = false;
|
||||||
$userFirstname = $this->getInput('registrationAddFirstname', helper::FILTER_STRING_SHORT, true);
|
// L'identifiant d'utilisateur est indisponible
|
||||||
$userLastname = $this->getInput('registrationAddLastname', helper::FILTER_STRING_SHORT, true);
|
$userId = $this->getInput('registrationAddId', helper::FILTER_ID, true);
|
||||||
$userMail = $this->getInput('registrationAddMail', helper::FILTER_MAIL, true);
|
if (is_array($this->getData(['user', $userId]))) {
|
||||||
// Pas de nom saisi
|
self::$inputNotices['registrationAddId'] = 'Identifiant invalide';
|
||||||
if (
|
$check = false;
|
||||||
empty($userFirstname) ||
|
}
|
||||||
empty($userLastname)
|
// Le compte existe déjà
|
||||||
) {
|
foreach ($this->getData(['user']) as $usersId => $user) {
|
||||||
$check = false;
|
if ($user['mail'] === $this->getInput('registrationAddMail', helper::FILTER_MAIL, true)) {
|
||||||
}
|
self::$inputNotices['registrationAddMail'] = 'Vous ne pouvez pas utilisez cette boite mail';
|
||||||
// Si tout est ok
|
$check = false;
|
||||||
if ($check === true) {
|
break;
|
||||||
// Enregistrement du compte dans les données du module
|
}
|
||||||
$auth = uniqid('', true);
|
}
|
||||||
$this->setData([
|
// Données de l'utilisateur
|
||||||
'module',
|
$userFirstname = $this->getInput('registrationAddFirstname', helper::FILTER_STRING_SHORT, true);
|
||||||
$this->getUrl(0),
|
$userLastname = $this->getInput('registrationAddLastname', helper::FILTER_STRING_SHORT, true);
|
||||||
'users',
|
$userMail = $this->getInput('registrationAddMail', helper::FILTER_MAIL, true);
|
||||||
$userId,
|
// Pas de nom saisi
|
||||||
[
|
if (
|
||||||
'firstname' => $userFirstname,
|
empty($userFirstname) ||
|
||||||
'lastname' => $userLastname,
|
empty($userLastname)
|
||||||
'mail' => $userMail,
|
) {
|
||||||
'password' => '',
|
$check = false;
|
||||||
// pas de groupe afin de le différencier dans la liste des users
|
}
|
||||||
'timer' => time(),
|
// Si tout est ok
|
||||||
'auth' => $auth,
|
if ($check === true) {
|
||||||
'status' => self::STATUS_EMAIL_AWAITING
|
// Enregistrement du compte dans les données du module
|
||||||
]
|
$auth = uniqid('', true);
|
||||||
]);
|
$this->setData([
|
||||||
// Mail d'avertissement aux administrateurs
|
'module',
|
||||||
// Utilisateurs dans le groupe admin
|
$this->getUrl(0),
|
||||||
$to = [];
|
'users',
|
||||||
foreach ($this->getData(['user']) as $key => $user) {
|
$userId,
|
||||||
if ($user['group'] == self::GROUP_ADMIN) {
|
[
|
||||||
$to[] = $user['mail'];
|
'firstname' => $userFirstname,
|
||||||
}
|
'lastname' => $userLastname,
|
||||||
}
|
'mail' => $userMail,
|
||||||
// Envoi du mail à l'administrateur
|
'password' => '',
|
||||||
if ($check && is_array($to)) {
|
// pas de groupe afin de le différencier dans la liste des users
|
||||||
$this->sendMail(
|
'timer' => time(),
|
||||||
$to,
|
'auth' => $auth,
|
||||||
'Auto-inscription sur le site ' . $this->getData(['config', 'title']),
|
'status' => self::STATUS_EMAIL_AWAITING
|
||||||
'<p>Un nouveau membre s\'est inscrit, son email est en attente de validation</p>' .
|
]
|
||||||
'<p><strong>Identifiant du compte :</strong> ' . $userId . ' (' . $userFirstname . ' ' . $userLastname . ')<br>' .
|
]);
|
||||||
'<strong>Email :</strong> ' . $userMail . '</p>' .
|
// Mail d'avertissement aux administrateurs
|
||||||
'<a href="' . helper::baseUrl() . 'user/login/' . strip_tags(str_replace('/', '_', $this->getUrl(0) . '/users')) . '">Validation de l\'inscription</a>',
|
// Utilisateurs dans le groupe admin
|
||||||
null,
|
$to = [];
|
||||||
$this->getData(['config', 'smtp', 'from'])
|
foreach ($this->getData(['user']) as $key => $user) {
|
||||||
);
|
if ($user['group'] == self::GROUP_ADMIN) {
|
||||||
}
|
$to[] = $user['mail'];
|
||||||
|
}
|
||||||
// Mail de confirmation à l'utilisateur
|
}
|
||||||
// forger le lien de vérification
|
// Envoi du mail à l'administrateur
|
||||||
$validateLink = helper::baseUrl(true) . $this->getUrl() . '/validate/' . $userId . '/' . $auth;
|
if ($check && is_array($to)) {
|
||||||
// Envoi
|
$this->sendMail(
|
||||||
if ($check) {
|
$to,
|
||||||
$sentMailtoUser = $this->sendMail(
|
'Auto-inscription sur le site ' . $this->getData(['config', 'title']),
|
||||||
$userMail,
|
'<p>Un nouveau membre s\'est inscrit, son email est en attente de validation</p>' .
|
||||||
'Confirmation de votre inscription',
|
'<p><strong>Identifiant du compte :</strong> ' . $userId . ' (' . $userFirstname . ' ' . $userLastname . ')<br>' .
|
||||||
'<p>' . $this->getdata(['module', $this->getUrl(0), 'config', 'mailRegisterContent']) . '</p>' .
|
'<strong>Email :</strong> ' . $userMail . '</p>' .
|
||||||
'<p><a href="' . $validateLink . '">Activer votre compte<a/>' . '</p>' .
|
'<a href="' . helper::baseUrl() . 'user/login/' . strip_tags(str_replace('/', '_', $this->getUrl(0) . '/users')) . '">Validation de l\'inscription</a>',
|
||||||
'<p>ou copiez collez le lien suivant dans un navigateur : ' . $validateLink . '</p>'
|
null,
|
||||||
,
|
$this->getData(['config', 'smtp', 'from'])
|
||||||
null,
|
);
|
||||||
$this->getData(['config', 'smtp', 'from'])
|
}
|
||||||
);
|
|
||||||
}
|
// Mail de confirmation à l'utilisateur
|
||||||
}
|
// forger le lien de vérification
|
||||||
// Valeurs en sortie
|
$validateLink = helper::baseUrl(true) . $this->getUrl() . '/validate/' . $userId . '/' . $auth;
|
||||||
$this->addOutput([
|
// Envoi
|
||||||
'redirect' => helper::baseUrl(),
|
if ($check) {
|
||||||
//'redirect' => $validateLink,
|
$sentMailtoUser = $this->sendMail(
|
||||||
'notification' => $sentMailtoUser ? "Un mail vous a été envoyé." : 'Quelque chose n\'a pas fonctionné !',
|
$userMail,
|
||||||
'state' => $sentMailtoUser ? true : false
|
'Confirmation de votre inscription',
|
||||||
]);
|
'<p>' . $this->getdata(['module', $this->getUrl(0), 'config', 'mailRegisterContent']) . '</p>' .
|
||||||
}
|
'<p><a href="' . $validateLink . '">Activer votre compte<a/>' . '</p>' .
|
||||||
// Valeurs en sortie
|
'<p>ou copiez collez le lien suivant dans un navigateur : ' . $validateLink . '</p>'
|
||||||
$this->addOutput([
|
,
|
||||||
'title' => 'Inscription',
|
null,
|
||||||
'view' => 'index',
|
$this->getData(['config', 'smtp', 'from'])
|
||||||
'showBarEditButton' => true,
|
);
|
||||||
'showPageContent' => true
|
}
|
||||||
]);
|
}
|
||||||
}
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
/**
|
'redirect' => helper::baseUrl(),
|
||||||
* Vérification de l'email
|
//'redirect' => $validateLink,
|
||||||
*/
|
'notification' => $sentMailtoUser ? "Un mail vous a été envoyé." : 'Quelque chose n\'a pas fonctionné !',
|
||||||
public function validate()
|
'state' => $sentMailtoUser ? true : false
|
||||||
{
|
]);
|
||||||
// Soumission du formulaire
|
}
|
||||||
if ($this->isPost()) {
|
}
|
||||||
// Vérifie la session + l'id + le timer
|
// Valeurs en sortie
|
||||||
$check = true;
|
$this->addOutput([
|
||||||
$notification = 'Bienvenue sur le site ' . $this->getData(['config', 'title']);
|
'title' => 'Inscription',
|
||||||
$userId = $this->getUrl(2);
|
'view' => 'index',
|
||||||
$auth = $this->getUrl(3);
|
'showBarEditButton' => true,
|
||||||
// la validité du lien est dépassé
|
'showPageContent' => true
|
||||||
if (
|
]);
|
||||||
(time() - $this->getData(['module', $this->getUrl(0), 'users', $userId, 'timer']))
|
}
|
||||||
>= $this->getdata(['module', $this->getUrl(0), 'config', 'timeOut'])
|
|
||||||
) {
|
/**
|
||||||
$check = false;
|
* Vérification de l'email
|
||||||
$notification = 'La validité du lien est dépassée';
|
*/
|
||||||
}
|
public function validate()
|
||||||
// La clé est incorrecte ou le compte n'est pas en attente de validation
|
{
|
||||||
if (
|
// Soumission du formulaire
|
||||||
$check
|
if ($this->isPost()) {
|
||||||
&& $auth !== $this->getData(['module', $this->getUrl(0), 'users', $userId, 'auth'])
|
// Vérifie la session + l'id + le timer
|
||||||
&& $this->getData(['module', $this->getUrl(0), 'users', $userId, 'status']) !== self::STATUS_EMAIL_AWAITING
|
$check = true;
|
||||||
) {
|
$notification = 'Bienvenue sur le site ' . $this->getData(['config', 'title']);
|
||||||
$check = false;
|
$userId = $this->getUrl(2);
|
||||||
$notification = 'Données incorrectes !';
|
$auth = $this->getUrl(3);
|
||||||
}
|
// la validité du lien est dépassé
|
||||||
// Double vérification pour le mot de passe
|
if (
|
||||||
if (
|
(time() - $this->getData(['module', $this->getUrl(0), 'users', $userId, 'timer']))
|
||||||
$check
|
>= $this->getdata(['module', $this->getUrl(0), 'config', 'timeOut'])
|
||||||
&& $this->getInput('registrationValidPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('registrationValidConfirmPassword', helper::FILTER_STRING_SHORT, true)
|
) {
|
||||||
) {
|
$check = false;
|
||||||
self::$inputNotices['registrationAddConfirmPassword'] = 'Les mots de passe ne sont pas identiques';
|
$notification = 'La validité du lien est dépassée';
|
||||||
$check = false;
|
}
|
||||||
}
|
// La clé est incorrecte ou le compte n'est pas en attente de validation
|
||||||
|
if (
|
||||||
if ($check) {
|
$check
|
||||||
if (
|
&& $auth !== $this->getData(['module', $this->getUrl(0), 'users', $userId, 'auth'])
|
||||||
// Pas d'approbation par un administrateur
|
&& $this->getData(['module', $this->getUrl(0), 'users', $userId, 'status']) !== self::STATUS_EMAIL_AWAITING
|
||||||
$this->getData(['module', $this->getUrl(0), 'config', 'approval']) === false
|
) {
|
||||||
) {
|
$check = false;
|
||||||
// Créer le compte
|
$notification = 'Données incorrectes !';
|
||||||
$this->setData([
|
}
|
||||||
'user',
|
// Double vérification pour le mot de passe
|
||||||
$userId,
|
if (
|
||||||
[
|
$check
|
||||||
'firstname' => $this->getData(['module', $this->getUrl(0), 'users', $userId, 'firstname']),
|
&& $this->getInput('registrationValidPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('registrationValidConfirmPassword', helper::FILTER_STRING_SHORT, true)
|
||||||
'lastname' => $this->getData(['module', $this->getUrl(0), 'users', $userId, 'lastname']),
|
) {
|
||||||
'mail' => $this->getData(['module', $this->getUrl(0), 'users', $userId, 'mail']),
|
self::$inputNotices['registrationAddConfirmPassword'] = 'Les mots de passe ne sont pas identiques';
|
||||||
'password' => $this->getInput('registrationValidPassword', helper::FILTER_PASSWORD, true),
|
$check = false;
|
||||||
'group' => self::GROUP_MEMBER,
|
}
|
||||||
'profil' => 1,
|
|
||||||
'forgot' => 0,
|
if ($check) {
|
||||||
'pseudo' => $userId,
|
if (
|
||||||
'signature' => 1,
|
// Pas d'approbation par un administrateur
|
||||||
'language' => self::$siteContent,
|
$this->getData(['module', $this->getUrl(0), 'config', 'approval']) === false
|
||||||
]
|
) {
|
||||||
]);
|
// Créer le compte
|
||||||
// Modifier le statut dans le module
|
$this->setData([
|
||||||
$this->deleteData(['module', $this->getUrl(0), 'users', $userId]);
|
'user',
|
||||||
$notification = 'Votre inscription est confirmée';
|
$userId,
|
||||||
} else {
|
[
|
||||||
// Approbation nécessaire
|
'firstname' => $this->getData(['module', $this->getUrl(0), 'users', $userId, 'firstname']),
|
||||||
$this->setData(['module', $this->getUrl(0), 'users', $userId, 'status', self::STATUS_ACCOUNT_AWAITING]);
|
'lastname' => $this->getData(['module', $this->getUrl(0), 'users', $userId, 'lastname']),
|
||||||
$notification = 'L\'inscription doit être approuvée par un administrateur';
|
'mail' => $this->getData(['module', $this->getUrl(0), 'users', $userId, 'mail']),
|
||||||
}
|
'password' => $this->getInput('registrationValidPassword', helper::FILTER_PASSWORD, true),
|
||||||
}
|
'group' => self::GROUP_MEMBER,
|
||||||
// Valeurs en sortie
|
'profil' => 1,
|
||||||
$this->addOutput([
|
'forgot' => 0,
|
||||||
'redirect' => $check ? helper::baseUrl() . $this->getdata(['module', $this->getUrl(0), 'config', 'pageSuccess']) : helper::baseUrl() . $this->getdata(['module', $this->getUrl(0), 'config', 'pageError']),
|
'pseudo' => $userId,
|
||||||
'notification' => $notification,
|
'signature' => 1,
|
||||||
'state' => $check
|
'language' => self::$siteContent,
|
||||||
]);
|
]
|
||||||
}
|
]);
|
||||||
// Valeurs en sortie
|
// Modifier le statut dans le module
|
||||||
$this->addOutput([
|
$this->deleteData(['module', $this->getUrl(0), 'users', $userId]);
|
||||||
'title' => 'Saisie du mot de passe',
|
$notification = 'Votre inscription est confirmée';
|
||||||
'view' => 'validate'
|
} else {
|
||||||
]);
|
// Approbation nécessaire
|
||||||
}
|
$this->setData(['module', $this->getUrl(0), 'users', $userId, 'status', self::STATUS_ACCOUNT_AWAITING]);
|
||||||
|
$notification = 'L\'inscription doit être approuvée par un administrateur';
|
||||||
/**
|
}
|
||||||
* Module de configuration
|
}
|
||||||
*/
|
// Valeurs en sortie
|
||||||
public function config()
|
$this->addOutput([
|
||||||
{
|
'redirect' => $check ? helper::baseUrl() . $this->getdata(['module', $this->getUrl(0), 'config', 'pageSuccess']) : helper::baseUrl() . $this->getdata(['module', $this->getUrl(0), 'config', 'pageError']),
|
||||||
// Soumission du formulaire
|
'notification' => $notification,
|
||||||
if (
|
'state' => $check
|
||||||
$this->getUser('permission', __CLASS__, __FUNCTION__) === true
|
]);
|
||||||
&& $this->isPost()
|
}
|
||||||
) {
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
// Lire les options et les enregistrer
|
'title' => 'Saisie du mot de passe',
|
||||||
$this->setData([
|
'view' => 'validate'
|
||||||
'module',
|
]);
|
||||||
$this->getUrl(0),
|
}
|
||||||
'config',
|
|
||||||
[
|
/**
|
||||||
'timeOut' => $this->getInput('registrationConfigTimeOut', helper::FILTER_INT) * 60,
|
* Module de configuration
|
||||||
'pageSuccess' => $this->getInput('registrationConfigSuccess'),
|
*/
|
||||||
'pageError' => $this->getInput('registrationConfigError'),
|
public function config()
|
||||||
'approval' => $this->getInput('registrationConfigState', helper::FILTER_BOOLEAN),
|
{
|
||||||
'mailRegisterContent' => $this->getInput('registrationconfigMailRegisterContent', null, true),
|
// Soumission du formulaire
|
||||||
'mailValidateContent' => $this->getInput('registrationconfigMailValidateContent', null, true),
|
if (
|
||||||
'layout' => $this->getInput('registrationConfigLayout'),
|
$this->getUser('permission', __CLASS__, __FUNCTION__) === true
|
||||||
'filter' => $this->getInput('registrationConfigFilter', helper::FILTER_STRING_SHORT)
|
&& $this->isPost()
|
||||||
]
|
) {
|
||||||
]);
|
|
||||||
$this->addOutput([
|
// Lire les options et les enregistrer
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
$this->setData([
|
||||||
'notification' => 'Modifications enregistrées',
|
'module',
|
||||||
'state' => true
|
$this->getUrl(0),
|
||||||
]);
|
'config',
|
||||||
}
|
[
|
||||||
// Valeurs en sortie
|
'timeOut' => $this->getInput('registrationConfigTimeOut', helper::FILTER_INT) * 60,
|
||||||
$this->addOutput([
|
'pageSuccess' => $this->getInput('registrationConfigSuccess'),
|
||||||
'title' => 'Configuration',
|
'pageError' => $this->getInput('registrationConfigError'),
|
||||||
'view' => 'config',
|
'approval' => $this->getInput('registrationConfigState', helper::FILTER_BOOLEAN),
|
||||||
'vendor' => ['tinymce']
|
'mailRegisterContent' => $this->getInput('registrationconfigMailRegisterContent', null, true),
|
||||||
]);
|
'mailValidateContent' => $this->getInput('registrationconfigMailValidateContent', null, true),
|
||||||
}
|
'layout' => $this->getInput('registrationConfigLayout'),
|
||||||
}
|
'filter' => $this->getInput('registrationConfigFilter', helper::FILTER_STRING_SHORT)
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
$this->addOutput([
|
||||||
|
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||||
|
'notification' => 'Modifications enregistrées',
|
||||||
|
'state' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'title' => 'Configuration',
|
||||||
|
'view' => 'config',
|
||||||
|
'vendor' => ['tinymce']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
/**
|
/**
|
||||||
* This file is part of Zwii.
|
* This file is part of Zwii.
|
||||||
*
|
*
|
||||||
* For full copyright and license information, please see the LICENSE
|
* For full copyright and license information, please see the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* @author Rémi Jean <remi.jean@outlook.com>
|
* @author Rémi Jean <remi.jean@outlook.com>
|
||||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||||
* @link http://zwiicms.com/
|
* @link http://zwiicms.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** NE PAS EFFACER
|
/** NE PAS EFFACER
|
||||||
* admin.css
|
* admin.css
|
||||||
*/
|
*/
|
||||||
|
|
||||||
textarea .editorWysiwyg {
|
textarea .editorWysiwyg {
|
||||||
height : 100px;
|
height : 100px;
|
||||||
}
|
}
|
@ -1,103 +1,103 @@
|
|||||||
<?php echo template::formOpen('registrationConfig'); ?>
|
<?php echo template::formOpen('registrationConfig'); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col1">
|
<div class="col1">
|
||||||
<?php echo template::button('registrationConfigBack', [
|
<?php echo template::button('registrationConfigBack', [
|
||||||
'class' => 'buttonGrey',
|
'class' => 'buttonGrey',
|
||||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0) . '/' . self::$siteContent,
|
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0) . '/' . self::$siteContent,
|
||||||
'value' => template::ico('left')
|
'value' => template::ico('left')
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col2 offset7">
|
<div class="col2 offset7">
|
||||||
<?php echo template::button('registrationConfigBack', [
|
<?php echo template::button('registrationConfigBack', [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/users',
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/users',
|
||||||
'value' => 'Inscriptions'
|
'value' => 'Inscriptions'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col2">
|
<div class="col2">
|
||||||
<?php echo template::submit('registrationConfigSubmit', [
|
<?php echo template::submit('registrationConfigSubmit', [
|
||||||
'class' => 'green'
|
'class' => 'green'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>Paramètres</h4>
|
<h4>Paramètres</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col4">
|
<div class="col4">
|
||||||
<?php echo template::select('registrationConfigLayout', $module::$layout, [
|
<?php echo template::select('registrationConfigLayout', $module::$layout, [
|
||||||
'label' => 'Disposition',
|
'label' => 'Disposition',
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'layout'])
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'layout'])
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col4">
|
<div class="col4">
|
||||||
<?php echo template::select('registrationConfigSuccess', helper::arraycollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
|
<?php echo template::select('registrationConfigSuccess', helper::arraycollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
|
||||||
'label' => 'Redirection après confirmation',
|
'label' => 'Redirection après confirmation',
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageSuccess'])
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageSuccess'])
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col4">
|
<div class="col4">
|
||||||
<?php echo template::select('registrationConfigError', helper::arraycollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
|
<?php echo template::select('registrationConfigError', helper::arraycollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
|
||||||
'label' => 'Redirection après erreur',
|
'label' => 'Redirection après erreur',
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageError'])
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageError'])
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>Communication</h4>
|
<h4>Communication</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col6">
|
<div class="col6">
|
||||||
<?php echo template::select('registrationConfigTimeOut', $module::$timeLimit, [
|
<?php echo template::select('registrationConfigTimeOut', $module::$timeLimit, [
|
||||||
'label' => 'Validité du lien',
|
'label' => 'Validité du lien',
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeOut']) / 60
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'timeOut']) / 60
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col6">
|
<div class="col6">
|
||||||
<?php echo template::text('registrationConfigFilter', [
|
<?php echo template::text('registrationConfigFilter', [
|
||||||
'label' => 'Domaines acceptés',
|
'label' => 'Domaines acceptés',
|
||||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'filter']),
|
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'filter']),
|
||||||
'help' => 'Champ vide sinon limitation à des domaines spécifiques, le séparateur est ;'
|
'help' => 'Champ vide sinon limitation à des domaines spécifiques, le séparateur est ;'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<?php $messageDefault = '<p>Confirmez votre inscription en cliquant sur ce lien dans les ... minutes.</p>'; ?>
|
<?php $messageDefault = '<p>Confirmez votre inscription en cliquant sur ce lien dans les ... minutes.</p>'; ?>
|
||||||
<?php echo template::textarea('registrationconfigMailRegisterContent', [
|
<?php echo template::textarea('registrationconfigMailRegisterContent', [
|
||||||
'label' => 'Corps du mail de confirmation',
|
'label' => 'Corps du mail de confirmation',
|
||||||
'value' => !empty($this->getData(['module', $this->getUrl(0), 'config', 'mailRegisterContent'])) ? $this->getData(['module', $this->getUrl(0), 'config', 'mailRegisterContent']) : $messageDefault,
|
'value' => !empty($this->getData(['module', $this->getUrl(0), 'config', 'mailRegisterContent'])) ? $this->getData(['module', $this->getUrl(0), 'config', 'mailRegisterContent']) : $messageDefault,
|
||||||
'class' => 'editorWysiwyg',
|
'class' => 'editorWysiwyg',
|
||||||
'help' => 'Précisez la durée de validité. Le lien sera inséré après ces explications.'
|
'help' => 'Précisez la durée de validité. Le lien sera inséré après ces explications.'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col6 verticalAlignMiddle">
|
<div class="col6 verticalAlignMiddle">
|
||||||
<?php echo template::checkbox('registrationConfigState', true, 'Approbation préalable', [
|
<?php echo template::checkbox('registrationConfigState', true, 'Approbation préalable', [
|
||||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'approval']),
|
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'approval']),
|
||||||
'help' => 'Les comptes sont inactifs tant que les inscriptions ne sont pas approuvées par un administrateur.',
|
'help' => 'Les comptes sont inactifs tant que les inscriptions ne sont pas approuvées par un administrateur.',
|
||||||
'check' => true
|
'check' => true
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<?php $messageDefault = '<p>Votre inscription a été approuvée par un administrateur.</p>'; ?>
|
<?php $messageDefault = '<p>Votre inscription a été approuvée par un administrateur.</p>'; ?>
|
||||||
<?php echo template::textarea('registrationconfigMailValidateContent', [
|
<?php echo template::textarea('registrationconfigMailValidateContent', [
|
||||||
'label' => 'Corps du mail d\'approbation',
|
'label' => 'Corps du mail d\'approbation',
|
||||||
'value' => !empty($this->getData(['module', $this->getUrl(0), 'config', 'mailValidateContent'])) ? $this->getData(['module', $this->getUrl(0), 'config', 'mailValidateContent']) : $messageDefault,
|
'value' => !empty($this->getData(['module', $this->getUrl(0), 'config', 'mailValidateContent'])) ? $this->getData(['module', $this->getUrl(0), 'config', 'mailValidateContent']) : $messageDefault,
|
||||||
'class' => 'editorWysiwyg'
|
'class' => 'editorWysiwyg'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php echo template::formClose(); ?>
|
<?php echo template::formClose(); ?>
|
||||||
<div class="moduleVersion">Version n°<?php echo $module::VERSION; ?>
|
<div class="moduleVersion">Version n°<?php echo $module::VERSION; ?>
|
||||||
</div>
|
</div>
|
@ -1,21 +1,21 @@
|
|||||||
/**
|
/**
|
||||||
* This file is part of Zwii.
|
* This file is part of Zwii.
|
||||||
*
|
*
|
||||||
* For full copyright and license information, please see the LICENSE
|
* For full copyright and license information, please see the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* @author Rémi Jean <remi.jean@outlook.com>
|
* @author Rémi Jean <remi.jean@outlook.com>
|
||||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||||
* @link http://zwiicms.com/
|
* @link http://zwiicms.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** NE PAS EFFACER
|
/** NE PAS EFFACER
|
||||||
* admin.css
|
* admin.css
|
||||||
*/
|
*/
|
||||||
#registrationUserEditProfil1Wrapper,
|
#registrationUserEditProfil1Wrapper,
|
||||||
#registrationUserEditProfil2Wrapper {
|
#registrationUserEditProfil2Wrapper {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
/**
|
/**
|
||||||
* This file is part of Zwii.
|
* This file is part of Zwii.
|
||||||
*
|
*
|
||||||
* For full copyright and license information, please see the LICENSE
|
* For full copyright and license information, please see the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||||
* @link http://zwiicms.com/
|
* @link http://zwiicms.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Droits des groupes
|
* Droits des groupes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$(".registrationUserEditGroupProfil").hide();
|
$(".registrationUserEditGroupProfil").hide();
|
||||||
$(".registrationUserCommentProfil").hide();
|
$(".registrationUserCommentProfil").hide();
|
||||||
$("#registrationUserEditGroupProfil" + $("#registrationUserEditGroup").val()).show();
|
$("#registrationUserEditGroupProfil" + $("#registrationUserEditGroup").val()).show();
|
||||||
$("#registrationUserCommentProfil" + $("#registrationUserEditGroup").val()).show();
|
$("#registrationUserCommentProfil" + $("#registrationUserEditGroup").val()).show();
|
||||||
|
|
||||||
$("#registrationUserEditGroup").on("change", function () {
|
$("#registrationUserEditGroup").on("change", function () {
|
||||||
$(".registrationUserEditGroupProfil").hide();
|
$(".registrationUserEditGroupProfil").hide();
|
||||||
$(".registrationUserCommentProfil").hide();
|
$(".registrationUserCommentProfil").hide();
|
||||||
$("#registrationUserEditGroupProfil" + $(this).val()).show();
|
$("#registrationUserEditGroupProfil" + $(this).val()).show();
|
||||||
$("#registrationUserCommentProfil" + $(this).val()).show();
|
$("#registrationUserCommentProfil" + $(this).val()).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
@ -1,140 +1,140 @@
|
|||||||
<?php echo template::formOpen('registrationUserEditForm'); ?>
|
<?php echo template::formOpen('registrationUserEditForm'); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col1">
|
<div class="col1">
|
||||||
<?php echo template::button('registrationUserEditBack', [
|
<?php echo template::button('registrationUserEditBack', [
|
||||||
'class' => 'buttonGrey',
|
'class' => 'buttonGrey',
|
||||||
'href' => helper::baseUrl() . $this->geturl(0) . '/users',
|
'href' => helper::baseUrl() . $this->geturl(0) . '/users',
|
||||||
'value' => template::ico('left')
|
'value' => template::ico('left')
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col2 offset9">
|
<div class="col2 offset9">
|
||||||
<?php echo template::submit('registrationUserEditSubmit', [
|
<?php echo template::submit('registrationUserEditSubmit', [
|
||||||
'class' => 'green'
|
'class' => 'green'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>Confirmation de l'inscription</h4>
|
<h4>Confirmation de l'inscription</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col6">
|
<div class="col6">
|
||||||
<?php echo template::text('registrationUserEditFirstname', [
|
<?php echo template::text('registrationUserEditFirstname', [
|
||||||
'autocomplete' => 'off',
|
'autocomplete' => 'off',
|
||||||
'label' => 'Prénom',
|
'label' => 'Prénom',
|
||||||
'value' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'firstname']),
|
'value' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'firstname']),
|
||||||
'disabled' => true
|
'disabled' => true
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col6">
|
<div class="col6">
|
||||||
<?php echo template::text('registrationUserEditLastname', [
|
<?php echo template::text('registrationUserEditLastname', [
|
||||||
'autocomplete' => 'off',
|
'autocomplete' => 'off',
|
||||||
'label' => 'Nom',
|
'label' => 'Nom',
|
||||||
'value' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'lastname']),
|
'value' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'lastname']),
|
||||||
'disabled' => true
|
'disabled' => true
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<?php echo template::mail('registrationUserEditMail', [
|
<?php echo template::mail('registrationUserEditMail', [
|
||||||
'autocomplete' => 'off',
|
'autocomplete' => 'off',
|
||||||
'label' => 'Adresse électronique',
|
'label' => 'Adresse électronique',
|
||||||
'value' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'mail']),
|
'value' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'mail']),
|
||||||
'disabled' => true
|
'disabled' => true
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col8">
|
<div class="col8">
|
||||||
<?php echo template::text('registrationUserState', [
|
<?php echo template::text('registrationUserState', [
|
||||||
'label' => 'État de l\'inscription',
|
'label' => 'État de l\'inscription',
|
||||||
'value' => $module::$statusGroups[$this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'status'])],
|
'value' => $module::$statusGroups[$this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'status'])],
|
||||||
'disabled' => true,
|
'disabled' => true,
|
||||||
'help' => 'En attente : le mail n\'a pas encore été validé<br>Email validé : approbation nécessaire.'
|
'help' => 'En attente : le mail n\'a pas encore été validé<br>Email validé : approbation nécessaire.'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col4">
|
<div class="col4">
|
||||||
<?php echo template::text('registrationUsertimer', [
|
<?php echo template::text('registrationUsertimer', [
|
||||||
'label' => 'Date de demande',
|
'label' => 'Date de demande',
|
||||||
'value' => helper::dateUTF8(date('Y-m-d G:i'), $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'timer'])),
|
'value' => helper::dateUTF8(date('Y-m-d G:i'), $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'timer'])),
|
||||||
'disabled' => true
|
'disabled' => true
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col4">
|
<div class="col4">
|
||||||
<?php echo template::text('registrationUserLabel', [
|
<?php echo template::text('registrationUserLabel', [
|
||||||
'label' => 'Étiquette'
|
'label' => 'Étiquette'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col4">
|
<div class="col4">
|
||||||
<?php if ($this->getUser('group') === self::GROUP_ADMIN): ?>
|
<?php if ($this->getUser('group') === self::GROUP_ADMIN): ?>
|
||||||
<?php echo template::select('registrationUserEditGroup', $module::$groups, [
|
<?php echo template::select('registrationUserEditGroup', $module::$groups, [
|
||||||
'disabled' => ($this->getUrl(2) === $this->getUser('id')),
|
'disabled' => ($this->getUrl(2) === $this->getUser('id')),
|
||||||
'help' => ($this->getUrl(2) === $this->getUser('id') ? 'Impossible de modifier votre propre groupe.' : ''),
|
'help' => ($this->getUrl(2) === $this->getUser('id') ? 'Impossible de modifier votre propre groupe.' : ''),
|
||||||
'label' => 'Groupe',
|
'label' => 'Groupe',
|
||||||
'selected' => $this->getData(['module', $this->getUrl(0), 'registrationUsers', $this->getUrl(2), 'status'])
|
'selected' => $this->getData(['module', $this->getUrl(0), 'registrationUsers', $this->getUrl(2), 'status'])
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col4">
|
<div class="col4">
|
||||||
<div class="registrationUserEditGroupProfil"
|
<div class="registrationUserEditGroupProfil"
|
||||||
id="registrationUserEditGroupProfil<?php echo self::GROUP_MEMBER; ?>">
|
id="registrationUserEditGroupProfil<?php echo self::GROUP_MEMBER; ?>">
|
||||||
<?php echo template::select('registrationUserEditProfil' . self::GROUP_MEMBER, $module::$userProfils[self::GROUP_MEMBER], [
|
<?php echo template::select('registrationUserEditProfil' . self::GROUP_MEMBER, $module::$userProfils[self::GROUP_MEMBER], [
|
||||||
'label' => 'Profil',
|
'label' => 'Profil',
|
||||||
'selected' => $this->getData(['user', $this->getUrl(2), 'profil']),
|
'selected' => $this->getData(['user', $this->getUrl(2), 'profil']),
|
||||||
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN,
|
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN,
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="registrationUserEditGroupProfil"
|
<div class="registrationUserEditGroupProfil"
|
||||||
id="registrationUserEditGroupProfil<?php echo self::GROUP_EDITOR; ?>">
|
id="registrationUserEditGroupProfil<?php echo self::GROUP_EDITOR; ?>">
|
||||||
<?php echo template::select('registrationUserEditProfil' . self::GROUP_EDITOR, $module::$userProfils[self::GROUP_EDITOR], [
|
<?php echo template::select('registrationUserEditProfil' . self::GROUP_EDITOR, $module::$userProfils[self::GROUP_EDITOR], [
|
||||||
'label' => 'Profil',
|
'label' => 'Profil',
|
||||||
'selected' => $this->getData(['user', $this->getUrl(2), 'profil']),
|
'selected' => $this->getData(['user', $this->getUrl(2), 'profil']),
|
||||||
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN,
|
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN,
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<div id="registrationUserCommentProfil<?php echo self::GROUP_MEMBER; ?>"
|
<div id="registrationUserCommentProfil<?php echo self::GROUP_MEMBER; ?>"
|
||||||
class="col12 registrationUserCommentProfil">
|
class="col12 registrationUserCommentProfil">
|
||||||
<?php echo template::textarea('registrationUserEditProfilComment' . self::GROUP_MEMBER, [
|
<?php echo template::textarea('registrationUserEditProfilComment' . self::GROUP_MEMBER, [
|
||||||
'label' => 'Commentaire',
|
'label' => 'Commentaire',
|
||||||
'value' => implode("\n", $module::$userProfilsComments[self::GROUP_MEMBER]),
|
'value' => implode("\n", $module::$userProfilsComments[self::GROUP_MEMBER]),
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
|
|
||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div id="registrationUserCommentProfil<?php echo self::GROUP_EDITOR; ?>"
|
<div id="registrationUserCommentProfil<?php echo self::GROUP_EDITOR; ?>"
|
||||||
class="col12 registrationUserCommentProfil">
|
class="col12 registrationUserCommentProfil">
|
||||||
<?php echo template::textarea('registrationUserEditProfilComment' . self::GROUP_EDITOR, [
|
<?php echo template::textarea('registrationUserEditProfilComment' . self::GROUP_EDITOR, [
|
||||||
'label' => 'Commentaire',
|
'label' => 'Commentaire',
|
||||||
'value' => implode("\n", $module::$userProfilsComments[self::GROUP_EDITOR]),
|
'value' => implode("\n", $module::$userProfilsComments[self::GROUP_EDITOR]),
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
|
|
||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div id="registrationUserCommentProfil<?php echo self::GROUP_ADMIN; ?>"
|
<div id="registrationUserCommentProfil<?php echo self::GROUP_ADMIN; ?>"
|
||||||
class="col12 registrationUserCommentProfil">
|
class="col12 registrationUserCommentProfil">
|
||||||
<?php echo template::textarea('registrationUserEditProfilComment' . self::GROUP_ADMIN, [
|
<?php echo template::textarea('registrationUserEditProfilComment' . self::GROUP_ADMIN, [
|
||||||
'label' => 'Commentaire',
|
'label' => 'Commentaire',
|
||||||
'value' => implode("\n", $module::$userProfilsComments[self::GROUP_ADMIN]),
|
'value' => implode("\n", $module::$userProfilsComments[self::GROUP_ADMIN]),
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php echo template::formClose(); ?>
|
<?php echo template::formClose(); ?>
|
@ -1,37 +1,37 @@
|
|||||||
/**
|
/**
|
||||||
* This file is part of Zwii.
|
* This file is part of Zwii.
|
||||||
*
|
*
|
||||||
* For full copyright and license information, please see the LICENSE
|
* For full copyright and license information, please see the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* @author Rémi Jean <remi.jean@outlook.com>
|
* @author Rémi Jean <remi.jean@outlook.com>
|
||||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||||
* @link http://zwiicms.com/
|
* @link http://zwiicms.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.inputRowContainer1,
|
.inputRowContainer1,
|
||||||
.inputRowContainer2,
|
.inputRowContainer2,
|
||||||
.inputRowContainer4,
|
.inputRowContainer4,
|
||||||
.inputColContainer {
|
.inputColContainer {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 10px; /* Espacement entre les inputs */
|
gap: 10px; /* Espacement entre les inputs */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* En lignes */
|
/* En lignes */
|
||||||
.inputRowContainer1 {
|
.inputRowContainer1 {
|
||||||
grid-template-columns: repeat(1, 1fr); /* 3 colonnes de largeur égale */
|
grid-template-columns: repeat(1, 1fr); /* 3 colonnes de largeur égale */
|
||||||
}
|
}
|
||||||
.inputRowContainer2 {
|
.inputRowContainer2 {
|
||||||
grid-template-columns: repeat(2, 1fr); /* 3 colonnes de largeur égale */
|
grid-template-columns: repeat(2, 1fr); /* 3 colonnes de largeur égale */
|
||||||
}
|
}
|
||||||
.inputRowContainer4 {
|
.inputRowContainer4 {
|
||||||
grid-template-columns: repeat(4, 1fr); /* 3 colonnes de largeur égale */
|
grid-template-columns: repeat(4, 1fr); /* 3 colonnes de largeur égale */
|
||||||
}
|
}
|
||||||
|
|
||||||
.inputColContainer {
|
.inputColContainer {
|
||||||
grid-template-rows: repeat(50px, auto); /* 3 rangées ajustées à la hauteur des contenus */
|
grid-template-rows: repeat(50px, auto); /* 3 rangées ajustées à la hauteur des contenus */
|
||||||
|
|
||||||
}
|
}
|
@ -1,47 +1,47 @@
|
|||||||
/**
|
/**
|
||||||
* This file is part of Zwii.
|
* This file is part of Zwii.
|
||||||
*
|
*
|
||||||
* For full copyright and license information, please see the LICENSE
|
* For full copyright and license information, please see the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||||
* @link http://zwiicms.com/
|
* @link http://zwiicms.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Affichage de l'id en simulant FILTER_ID
|
* Affichage de l'id en simulant FILTER_ID
|
||||||
*/
|
*/
|
||||||
$("#registrationAddId").on("change keydown keyup", function(event) {
|
$("#registrationAddId").on("change keydown keyup", function(event) {
|
||||||
var userId = $(this).val();
|
var userId = $(this).val();
|
||||||
if(
|
if(
|
||||||
event.keyCode !== 8 // BACKSPACE
|
event.keyCode !== 8 // BACKSPACE
|
||||||
&& event.keyCode !== 37 // LEFT
|
&& event.keyCode !== 37 // LEFT
|
||||||
&& event.keyCode !== 39 // RIGHT
|
&& event.keyCode !== 39 // RIGHT
|
||||||
&& event.keyCode !== 46 // DELETE
|
&& event.keyCode !== 46 // DELETE
|
||||||
&& window.getSelection().toString() !== userId // Texte sélectionné
|
&& window.getSelection().toString() !== userId // Texte sélectionné
|
||||||
) {
|
) {
|
||||||
var searchReplace = {
|
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",
|
||||||
"Á": "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) {
|
userId = userId.replace(/[áàâäãåçéèêëíìîïñóòôöõúùûüýÿ'" ]/ig, function(match) {
|
||||||
return searchReplace[match];
|
return searchReplace[match];
|
||||||
});
|
});
|
||||||
userId = userId.replace(/[^a-z0-9-]/ig, "");
|
userId = userId.replace(/[^a-z0-9-]/ig, "");
|
||||||
$(this).val(userId);
|
$(this).val(userId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Droits des groupes
|
* Droits des groupes
|
||||||
*/
|
*/
|
||||||
$("#registrationAddGroup").on("change", function() {
|
$("#registrationAddGroup").on("change", function() {
|
||||||
$(".registrationAddGroupDescription").hide();
|
$(".registrationAddGroupDescription").hide();
|
||||||
$("#registrationAddGroupDescription" + $(this).val()).show();
|
$("#registrationAddGroupDescription" + $(this).val()).show();
|
||||||
}).trigger("change");
|
}).trigger("change");
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
<?php echo template::formOpen('registrationAddForm'); ?>
|
<?php echo template::formOpen('registrationAddForm'); ?>
|
||||||
<div class="<?php echo $this->getData(['module', $this->getUrl(0), 'config', 'layout']); ?>">
|
<div class="<?php echo $this->getData(['module', $this->getUrl(0), 'config', 'layout']); ?>">
|
||||||
<?php echo template::text('registrationAddFirstname', [
|
<?php echo template::text('registrationAddFirstname', [
|
||||||
'autocomplete' => 'off',
|
'autocomplete' => 'off',
|
||||||
'label' => 'Prénom'
|
'label' => 'Prénom'
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::text('registrationAddLastname', [
|
<?php echo template::text('registrationAddLastname', [
|
||||||
'autocomplete' => 'off',
|
'autocomplete' => 'off',
|
||||||
'label' => 'Nom'
|
'label' => 'Nom'
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::text('registrationAddId', [
|
<?php echo template::text('registrationAddId', [
|
||||||
'autocomplete' => 'off',
|
'autocomplete' => 'off',
|
||||||
'label' => 'Identifiant de connexion'
|
'label' => 'Identifiant de connexion'
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::mail('registrationAddMail', [
|
<?php echo template::mail('registrationAddMail', [
|
||||||
'autocomplete' => 'off',
|
'autocomplete' => 'off',
|
||||||
'label' => 'Adresse électronique'
|
'label' => 'Adresse électronique'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='submitContainer'>
|
<div class='submitContainer'>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col2 offset10">
|
<div class="col2 offset10">
|
||||||
<?php echo template::submit('registrationAddSubmit', [
|
<?php echo template::submit('registrationAddSubmit', [
|
||||||
'value' => 'Envoyer'
|
'value' => 'Envoyer'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php echo template::formClose(); ?>
|
<?php echo template::formClose(); ?>
|
@ -1,17 +1,17 @@
|
|||||||
/**
|
/**
|
||||||
* This file is part of Zwii.
|
* This file is part of Zwii.
|
||||||
*
|
*
|
||||||
* For full copyright and license information, please see the LICENSE
|
* For full copyright and license information, please see the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* @author Rémi Jean <remi.jean@outlook.com>
|
* @author Rémi Jean <remi.jean@outlook.com>
|
||||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||||
* @link http://zwiicms.com/
|
* @link http://zwiicms.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** NE PAS EFFACER
|
/** NE PAS EFFACER
|
||||||
* admin.css
|
* admin.css
|
||||||
*/
|
*/
|
@ -1,21 +1,21 @@
|
|||||||
/**
|
/**
|
||||||
* This file is part of Zwii.
|
* This file is part of Zwii.
|
||||||
*
|
*
|
||||||
* For full copyright and license information, please see the LICENSE
|
* For full copyright and license information, please see the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||||
* @link http://zwiicms.com/
|
* @link http://zwiicms.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirmation de suppression
|
* Confirmation de suppression
|
||||||
*/
|
*/
|
||||||
$(".registrationUserDelete").on("click", function() {
|
$(".registrationUserDelete").on("click", function() {
|
||||||
var _this = $(this);
|
var _this = $(this);
|
||||||
return core.confirm("Êtes-vous sûr de vouloir supprimer cet utilisateur ?", function() {
|
return core.confirm("Êtes-vous sûr de vouloir supprimer cet utilisateur ?", function() {
|
||||||
$(location).attr("href", _this.attr("href"));
|
$(location).attr("href", _this.attr("href"));
|
||||||
});
|
});
|
||||||
});
|
});
|
@ -1,15 +1,15 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col1">
|
<div class="col1">
|
||||||
<?php echo template::button('registrationUserBack', [
|
<?php echo template::button('registrationUserBack', [
|
||||||
'class' => 'buttonGrey',
|
'class' => 'buttonGrey',
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||||
'value' => template::ico('left')
|
'value' => template::ico('left')
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if($module::$users): ?>
|
<?php if($module::$users): ?>
|
||||||
<?php echo template::table([3, 3, 2,21, 1, 1], $module::$users, ['Identifiant', 'Nom', 'Etat', 'Date', '', '']); ?>
|
<?php echo template::table([3, 3, 2,21, 1, 1], $module::$users, ['Identifiant', 'Nom', 'Etat', 'Date', '', '']); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo template::speech('Pas d\'inscription en attente.'); ?>
|
<?php echo template::speech('Pas d\'inscription en attente.'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
@ -1,34 +1,34 @@
|
|||||||
/**
|
/**
|
||||||
* This file is part of Zwii.
|
* This file is part of Zwii.
|
||||||
*
|
*
|
||||||
* For full copyright and license information, please see the LICENSE
|
* For full copyright and license information, please see the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* @author Rémi Jean <remi.jean@outlook.com>
|
* @author Rémi Jean <remi.jean@outlook.com>
|
||||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||||
* @link http://zwiicms.com/
|
* @link http://zwiicms.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.inputRowContainer1,
|
.inputRowContainer1,
|
||||||
.inputRowContainer2,
|
.inputRowContainer2,
|
||||||
.inputRowContainer4,
|
.inputRowContainer4,
|
||||||
.inputColContainer {
|
.inputColContainer {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* En lignes */
|
/* En lignes */
|
||||||
.inputRowContainer1 {
|
.inputRowContainer1 {
|
||||||
grid-template-columns: repeat(1, 1fr);
|
grid-template-columns: repeat(1, 1fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
.inputRowContainer2 {
|
.inputRowContainer2 {
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
.inputRowContainer4 {
|
.inputRowContainer4 {
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
}
|
}
|
@ -1,23 +1,23 @@
|
|||||||
<?php echo template::formOpen('registrationValidForm'); ?>
|
<?php echo template::formOpen('registrationValidForm'); ?>
|
||||||
<h3>Email confirmé</h3>
|
<h3>Email confirmé</h3>
|
||||||
<div class="<?php echo $this->getData(['module',$this->getUrl(0),'config','layout']); ?>">
|
<div class="<?php echo $this->getData(['module',$this->getUrl(0),'config','layout']); ?>">
|
||||||
<?php echo template::password('registrationValidPassword', [
|
<?php echo template::password('registrationValidPassword', [
|
||||||
'autocomplete' => 'off',
|
'autocomplete' => 'off',
|
||||||
'label' => 'Mot de passe'
|
'label' => 'Mot de passe'
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::password('registrationValidConfirmPassword', [
|
<?php echo template::password('registrationValidConfirmPassword', [
|
||||||
'autocomplete' => 'off',
|
'autocomplete' => 'off',
|
||||||
'label' => 'Confirmation du mot de passe'
|
'label' => 'Confirmation du mot de passe'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='submitContainer'>
|
<div class='submitContainer'>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col2 offset10">
|
<div class="col2 offset10">
|
||||||
<?php echo template::submit('registrationValidSubmit', [
|
<?php echo template::submit('registrationValidSubmit', [
|
||||||
'value' => 'Envoyer',
|
'value' => 'Envoyer',
|
||||||
'class' => 'green'
|
'class' => 'green'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php echo template::formClose(); ?>
|
<?php echo template::formClose(); ?>
|
Loading…
Reference in New Issue
Block a user