diff --git a/chat/chat.php b/chat/chat.php deleted file mode 100644 index 2f04ccf..0000000 --- a/chat/chat.php +++ /dev/null @@ -1,89 +0,0 @@ - - * @copyright Copyright (C) 2018-2025, Frédéric Tempez - * @license CC Attribution-NonCommercial-NoDerivatives 4.0 International - * @link http://zwiicms.fr/ - */ - -class chat extends common -{ - const VERSION = '0.1'; - const REALNAME = 'Chat'; - const DELETE = true; - const UPDATE = '0.0'; - const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json) - - public static $actions = [ - //'add' => self::GROUP_MODERATOR, - //'config' => self::GROUP_MODERATOR, - //'edit' => self::GROUP_MODERATOR, - 'index' => self::GROUP_VISITOR, - 'getFormattedMessages' => self::GROUP_VISITOR, - ]; - - public static $messages = []; - - public function index(): void - { - - if ($this->isPost()) { - - $message = filter_input(INPUT_POST, 'message'); - - if ($message) { - $timestamp = time(); - $userId = $this->getUser('id'); - - $chatData = $this->getData(['module', $this->getUrl(2), 'chat']) ?? []; - $chatData[$timestamp] = [ - 'user_id' => $userId, - 'message' => $message - ]; - - $this->setData(['module', $this->getUrl(2), 'chat'], $chatData); - - if ( - isset($_SERVER['HTTP_X_REQUESTED_WITH']) && - strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest' - ) { - echo json_encode(['success' => true]); - exit; - } - } - } - - self::$messages = $this->getFormattedMessages(); - - // Valeurs en sortie - $this->addOutput([ - 'title' => 'ChatRoom', - 'view' => 'index' - ]); - } - - private function getFormattedMessages() - { - $chatData = $this->getData(['module', $this->getUrl(2), 'chat']) ?? []; - $messages = []; - - krsort($chatData); - - foreach ($chatData as $timestamp => $data) { - $messages[] = [ - 'timestamp' => $timestamp, - 'user_id' => $data['user_id'], - 'username' => $this->getUser('id'), - 'message' => $data['message'] - ]; - } - - return $messages; - } -} diff --git a/chat/view/index/index.css b/chat/view/index/index.css deleted file mode 100644 index 6c32448..0000000 --- a/chat/view/index/index.css +++ /dev/null @@ -1,55 +0,0 @@ -.chat-container { - max-width: 800px; - margin: 0 auto; -} - -.chat-messages { - height: 400px; - overflow-y: auto; - border: 1px solid #ccc; - padding: 10px; - margin-bottom: 10px; -} - -.message { - margin-bottom: 10px; - padding: 5px; - background: #f5f5f5; - border-radius: 4px; -} - -.username { - font-weight: bold; - margin-right: 10px; - color: #2c5282; -} - -.timestamp { - color: #666; - font-size: 0.8em; -} - -.chat-form { - display: flex; - gap: 10px; -} - -#messageInput { - flex: 1; - padding: 8px; - border: 1px solid #ccc; - border-radius: 4px; -} - -button { - padding: 8px 16px; - background: #4299e1; - color: white; - border: none; - border-radius: 4px; - cursor: pointer; -} - -button:hover { - background: #2b6cb0; -} \ No newline at end of file diff --git a/chat/view/index/index.js.php b/chat/view/index/index.js.php deleted file mode 100644 index 0f104df..0000000 --- a/chat/view/index/index.js.php +++ /dev/null @@ -1,37 +0,0 @@ -document.getElementById('chatForm').addEventListener('submit', function (e) { - e.preventDefault(); - - const messageInput = document.getElementById('messageInput'); - const message = messageInput.value; - - fetch(window.location.href, { - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-Requested-With': 'XMLHttpRequest' - }, - body: 'message=' + encodeURIComponent(message) - }) - .then(response => response.json()) - .then(data => { - if (data.success) { - messageInput.value = ''; - location.reload(); // Option simple - vous pourriez préférer une mise à jour AJAX plus sophistiquée - } - }); -}); - -// Fonction optionnelle pour actualiser automatiquement le chat -function refreshChat() { - fetch(window.location.href) - .then(response => response.text()) - .then(html => { - const parser = new DOMParser(); - const doc = parser.parseFromString(html, 'text/html'); - const newMessages = doc.querySelector('#chatMessages').innerHTML; - document.getElementById('chatMessages').innerHTML = newMessages; - }); -} - -// Décommentez pour activer l'actualisation automatique -// setInterval(refreshChat, 10000); // Actualise toutes les 10 secondes \ No newline at end of file diff --git a/chat/view/index/index.php b/chat/view/index/index.php deleted file mode 100644 index 7e8dfeb..0000000 --- a/chat/view/index/index.php +++ /dev/null @@ -1,18 +0,0 @@ -
-
- -
- - -

-
- -
- -
- - -
-
\ No newline at end of file diff --git a/download/view/add/add.php b/download/view/add/add.php index 31a5a35..125eaaa 100644 --- a/download/view/add/add.php +++ b/download/view/add/add.php @@ -56,13 +56,13 @@ ]); ?>
- 'Licence' ]); ?>
- 'Catégorie' ]); } else { @@ -83,7 +83,7 @@
- 'Type de ressource', 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'ressourceType']) ]); ?> @@ -123,7 +123,7 @@

Options de publication

- 'Auteur', 'selected' => $this->getUser('id'), 'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false @@ -138,9 +138,9 @@ ]); ?>
- 'Edition - Suppression', - 'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent'])) ? download::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent']), + 'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent']), 'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'item sans restriction' ]); ?>
@@ -165,7 +165,7 @@ ]); ?>
- 'Choix du nombre maximum de caractères pour chaque commentaire de l\'item, mise en forme html comprise.', 'label' => 'Caractères par commentaire', 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentMaxlength']) @@ -180,7 +180,7 @@ ]); ?>
- $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentGroupNotification']), 'help' => 'Editeurs = éditeurs + administrateurs
Membres = membres + éditeurs + administrateurs' ]); ?> diff --git a/download/view/categories/categories.php b/download/view/categories/categories.php index 9fd6aa0..93fc272 100644 --- a/download/view/categories/categories.php +++ b/download/view/categories/categories.php @@ -29,12 +29,12 @@
- - - + + +
Version n° - +
\ No newline at end of file diff --git a/download/view/comment/comment.php b/download/view/comment/comment.php index 234d1cb..8743ace 100644 --- a/download/view/comment/comment.php +++ b/download/view/comment/comment.php @@ -7,14 +7,14 @@ ]); ?>
- +
- +
- - '; ?> + + '; ?> diff --git a/download/view/config/config.php b/download/view/config/config.php index c6467b1..057af25 100644 --- a/download/view/config/config.php +++ b/download/view/config/config.php @@ -29,12 +29,12 @@ ]); ?> - - - + + +
Version n° - +
\ No newline at end of file diff --git a/download/view/edit/edit.php b/download/view/edit/edit.php index cf7c198..81d4e01 100644 --- a/download/view/edit/edit.php +++ b/download/view/edit/edit.php @@ -68,14 +68,14 @@ ]); ?>
- 'Licence', 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'license']) ]); ?>
- 'Catégorie', 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'category']) ]); @@ -99,7 +99,7 @@
- 'Type de ressource', 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'ressourceType']) ]); ?> @@ -141,7 +141,7 @@

Options de publication

- 'Auteur', 'selected' => $this->getUser('id'), 'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false @@ -156,9 +156,9 @@ ]); ?>
- 'Edition - Suppression', - 'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent'])) ? download::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent']), + 'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent']), 'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'item sans restriction' ]); ?>
@@ -183,7 +183,7 @@ ]); ?>
- 'Choix du nombre maximum de caractères pour chaque commentaire de l\'item, mise en forme html comprise.', 'label' => 'Caractères par commentaire', 'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentMaxlength']) @@ -198,7 +198,7 @@ ]); ?>
- $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentGroupNotification']), 'help' => 'Editeurs = éditeurs + administrateurs
Membres = membres + éditeurs + administrateurs' ]); ?> diff --git a/download/view/index/index.php b/download/view/index/index.php index 53d76c3..dbb235b 100644 --- a/download/view/index/index.php +++ b/download/view/index/index.php @@ -1,7 +1,7 @@ - +
- $item): ?> + $item): ?>
- + getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
- + getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) @@ -102,7 +102,7 @@ AND ( // Propriétaire ( - $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === download::EDIT_OWNER + $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER AND ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'userId']) === $this->getUser('id') OR $this->getUser('group') === self::GROUP_ADMIN ) ) @@ -114,8 +114,8 @@ ) OR ( // Tout le monde - $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === download::EDIT_ALL - AND $this->getUser('group') >= download::$actions['config'] + $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL + AND $this->getUser('group') >= $module::$actions['config'] ) ) ): ?> @@ -145,8 +145,8 @@

Cet item ne reçoit pas de commentaire.

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

@@ -160,7 +160,7 @@ 'Nom', 'readonly' => true, - 'value' => download::$editCommentSignature + 'value' => $module::$editCommentSignature ]); ?> $this->getUser('id') @@ -218,9 +218,9 @@
- $comment): ?> + $comment): ?>
-

+

le

- \ No newline at end of file + \ No newline at end of file diff --git a/download/view/option/option.php b/download/view/option/option.php index 0804a1e..9068b70 100644 --- a/download/view/option/option.php +++ b/download/view/option/option.php @@ -30,7 +30,7 @@ ]); ?>
- 'Articles par page', 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']) ]); ?> @@ -42,6 +42,6 @@
Version n° - +
diff --git a/download/view/stats/stats.php b/download/view/stats/stats.php index 1693c86..5b778f3 100644 --- a/download/view/stats/stats.php +++ b/download/view/stats/stats.php @@ -21,16 +21,16 @@

Nombre de téléchargements : - +

- - - + + +
Version n° - +
\ No newline at end of file