Final 0.2

This commit is contained in:
Flatlogic Bot 2026-02-16 23:16:16 +00:00
parent 5083b2794c
commit e3e1dc3456
4 changed files with 48 additions and 8 deletions

View File

@ -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));

View File

@ -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) {

View File

@ -923,19 +923,26 @@ $emote_html = '<img src="' . htmlspecialchars($ce['path']) . '" alt="' . htmlspe
<div id="typing-indicator" class="typing-indicator"></div>
<div class="chat-input-container">
<?php
require_once 'includes/permissions.php';
$can_send = Permissions::canSendInChannel($current_user_id, $active_channel_id);
$show_input = true;
if ($channel_type === 'rules') $show_input = false;
if ($channel_type === 'forum' && !$active_thread) $show_input = false;
if ($channel_type === 'announcement' && !$can_manage_channels) $show_input = false;
if ($show_input):
$allow_files = true;
foreach($channels as $c) {
if($c['id'] == $active_channel_id) {
$allow_files = (bool)$c['allow_file_sharing'];
break;
if (!$can_send) {
echo '<div class="chat-input-wrapper justify-content-center p-3 text-muted small" style="background-color: #2b2d31; border-radius: 8px;">
<i class="fa-solid fa-lock me-2"></i> Vous ne disposez pas de la permission d\'envoyer des messages dans ce salon.
</div>';
} else {
$allow_files = true;
foreach($channels as $c) {
if($c['id'] == $active_channel_id) {
$allow_files = (bool)$c['allow_file_sharing'];
break;
}
}
}
?>
<div id="upload-progress-container" class="upload-progress-container" style="display: none;">
<div class="progress" style="height: 4px; background-color: var(--separator); border-radius: 2px; overflow: hidden;">
@ -964,6 +971,7 @@ $emote_html = '<img src="' . htmlspecialchars($ce['path']) . '" alt="' . htmlspe
</button>
</div>
</form>
<?php } ?>
<?php endif; ?>
</div>
</div>
@ -1698,6 +1706,25 @@ async function handleSaveUserSettings(btn) {
</div>
</div>
</div>
<div class="permission-item mb-3 p-2 rounded" style="background: var(--separator-soft);">
<div class="d-flex justify-content-between align-items-center">
<div class="pe-3">
<div class="fw-bold" style="color: #ffffff; font-size: 0.9em;">Send Messages</div>
<div style="font-size: 0.75em; color: #b5bac1;">Allows members to send messages in this channel.</div>
</div>
<div class="btn-group btn-group-sm perm-tri-state" data-perm-bit="2">
<input type="radio" class="btn-check" name="perm_2" id="perm_2_deny" value="deny">
<label class="btn btn-outline-danger border-0" for="perm_2_deny" title="Deny"><i class="fa-solid fa-xmark"></i></label>
<input type="radio" class="btn-check" name="perm_2" id="perm_2_neutral" value="neutral" checked>
<label class="btn btn-outline-secondary border-0" for="perm_2_neutral" title="Neutral">/</label>
<input type="radio" class="btn-check" name="perm_2" id="perm_2_allow" value="allow">
<label class="btn btn-outline-success border-0" for="perm_2_allow" title="Allow"><i class="fa-solid fa-check"></i></label>
</div>
</div>
</div>
<!-- More permissions can be added here -->
</div>
</div>

View File

@ -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: []