regles v2

This commit is contained in:
Flatlogic Bot 2026-02-16 00:04:01 +00:00
parent a35fd4aafb
commit f41686b17d
3 changed files with 8 additions and 3 deletions

View File

@ -78,11 +78,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'PATCH') {
$id = $data['id'] ?? 0;
$dir = $data['dir'] ?? 'up';
$stmt = db()->prepare("SELECT channel_id, position FROM channel_rules WHERE id = ?");
// Check permission
$stmt = db()->prepare("SELECT c.server_id, r.channel_id, r.position FROM channels c JOIN channel_rules r ON c.id = r.channel_id WHERE r.id = ?");
$stmt->execute([$id]);
$current = $stmt->fetch();
if ($current) {
if ($current && Permissions::hasPermission($user_id, $current['server_id'], Permissions::MANAGE_CHANNELS)) {
$channel_id = $current['channel_id'];
$pos = $current['position'];

View File

@ -987,6 +987,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
if (e.target.classList.contains('move-rule-btn')) {
if (!window.canManageChannels) return;
const id = e.target.dataset.id;
const dir = e.target.dataset.dir;
const resp = await fetch('api_v1_rules.php', {
@ -1905,7 +1906,7 @@ document.addEventListener('DOMContentLoaded', () => {
});
const rulesListSortable = document.getElementById('rules-list-sortable');
if (typeof Sortable !== 'undefined' && rulesListSortable) {
if (typeof Sortable !== 'undefined' && rulesListSortable && window.canManageChannels) {
new Sortable(rulesListSortable, {
animation: 150,
ghostClass: 'sortable-ghost',

View File

@ -58,3 +58,6 @@
2026-02-15 23:57:30 - GET /index.php?server_id=1&channel_id=11 - POST: []
2026-02-15 23:57:46 - GET /index.php?server_id=1&channel_id=6 - POST: []
2026-02-15 23:57:49 - GET /index.php?server_id=1&channel_id=11 - POST: []
2026-02-15 23:59:43 - GET /?fl_project=38443 - POST: []
2026-02-16 00:02:15 - GET /index.php?server_id=1&channel_id=11 - POST: []
2026-02-16 00:02:20 - GET /index.php?server_id=1&channel_id=11 - POST: []