From e3e1dc3456e1976b0d299d37d88bf36b9f860391 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Mon, 16 Feb 2026 23:16:16 +0000 Subject: [PATCH] Final 0.2 --- api_v1_threads.php | 6 ++++++ assets/js/main.js | 5 +++-- index.php | 39 +++++++++++++++++++++++++++++++++------ requests.log | 6 ++++++ 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/api_v1_threads.php b/api_v1_threads.php index 8ddc361..f2610cd 100644 --- a/api_v1_threads.php +++ b/api_v1_threads.php @@ -13,6 +13,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { exit; } + require_once 'includes/permissions.php'; + if (!Permissions::canSendInChannel($user_id, $channel_id)) { + echo json_encode(['success' => false, 'error' => 'You do not have permission to create threads in this channel.']); + exit; + } + $tag_ids = $_POST['tag_ids'] ?? []; if (is_string($tag_ids)) { $tag_ids = array_filter(explode(',', $tag_ids)); diff --git a/assets/js/main.js b/assets/js/main.js index c0f664c..053a8e4 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1123,8 +1123,9 @@ document.addEventListener('DOMContentLoaded', () => { // Load existing permissions for this role const p = channelPermissionsData.find(perm => perm.role_id == roleId) || { allow_permissions: 0, deny_permissions: 0 }; - // Update toggles (for now only bit 1: View Channel) - updateToggleUI(1, p.allow_permissions, p.deny_permissions); + // Update toggles + updateToggleUI(1, p.allow_permissions, p.deny_permissions); // View Channel + updateToggleUI(2, p.allow_permissions, p.deny_permissions); // Send Messages } function updateToggleUI(bit, allowPerms, denyPerms) { diff --git a/index.php b/index.php index d588389..d4fcae6 100644 --- a/index.php +++ b/index.php @@ -923,19 +923,26 @@ $emote_html = '' . htmlspe
         <div id=
+ Vous ne disposez pas de la permission d\'envoyer des messages dans ce salon. +
'; + } else { + $allow_files = true; + foreach($channels as $c) { + if($c['id'] == $active_channel_id) { + $allow_files = (bool)$c['allow_file_sharing']; + break; + } } - } ?> diff --git a/requests.log b/requests.log index bf9c7b5..acf0581 100644 --- a/requests.log +++ b/requests.log @@ -363,3 +363,9 @@ 2026-02-16 23:01:08 - GET /index.php?server_id=1&channel_id=1 - POST: [] 2026-02-16 23:01:09 - GET /index.php?server_id=1&channel_id=6 - POST: [] 2026-02-16 23:01:23 - GET /index.php?server_id=1&channel_id=6 - POST: [] +2026-02-16 23:04:26 - GET /?fl_project=38443 - POST: [] +2026-02-16 23:05:06 - GET /index.php?server_id=1&channel_id=17 - POST: [] +2026-02-16 23:05:13 - GET /index.php?server_id=1&channel_id=15 - POST: [] +2026-02-16 23:05:15 - GET /index.php?server_id=1&channel_id=6 - POST: [] +2026-02-16 23:05:29 - GET /index.php?server_id=1&channel_id=6 - POST: [] +2026-02-16 23:13:30 - GET /index.php?server_id=1&channel_id=12 - POST: []