prepare('INSERT INTO tbl_scwebhooks (cl_scwebhook_name, cl_scwebhook_url, cl_scwebhook_is_forum) VALUES (:name, :url, :is_forum)'); $stmt->execute([ 'name' => $cl_scwebhook_name, 'url' => $cl_scwebhook_url, 'is_forum' => $cl_scwebhook_is_forum, ]); auth_flash_set('success', 'Webhook Discord ajouté avec succès.'); } else { if ($webhook_id <= 0) { throw new RuntimeException('ID de webhook invalide.'); } $stmt = $db->prepare('UPDATE tbl_scwebhooks SET cl_scwebhook_name = :name, cl_scwebhook_url = :url, cl_scwebhook_is_forum = :is_forum WHERE cl_scwebhook_id = :id'); $stmt->execute([ 'name' => $cl_scwebhook_name, 'url' => $cl_scwebhook_url, 'is_forum' => $cl_scwebhook_is_forum, 'id' => $webhook_id, ]); auth_flash_set('success', 'Webhook Discord mis à jour.'); } } catch (Throwable $e) { auth_flash_set('error', 'Erreur webhook : ' . $e->getMessage()); } header('Location: scwebhook.php'); exit; } if ($action === 'delete_webhook') { $webhook_id = (int) ($_POST['webhook_id'] ?? 0); if ($webhook_id > 0) { try { $stmt_usage = $db->prepare('SELECT COUNT(*) FROM tbl_scnotifications WHERE cl_scnotification_webhook_id = :id'); $stmt_usage->execute(['id' => $webhook_id]); $usage_total = (int) $stmt_usage->fetchColumn(); if ($usage_total > 0) { auth_flash_set('error', 'Suppression refusée : ce webhook est déjà relié à l’historique des notifications.'); } else { $stmt = $db->prepare('DELETE FROM tbl_scwebhooks WHERE cl_scwebhook_id = :id'); $stmt->execute(['id' => $webhook_id]); auth_flash_set('success', 'Webhook Discord supprimé.'); } } catch (Throwable $e) { auth_flash_set('error', 'Erreur suppression webhook : ' . $e->getMessage()); } } header('Location: scwebhook.php'); exit; } if ($action === 'add_banner' || $action === 'update_banner') { $banner_id = (int) ($_POST['banner_id'] ?? 0); $cl_scbanner_name = trim((string) ($_POST['cl_scbanner_name'] ?? '')); $cl_scbanner_url = trim((string) ($_POST['cl_scbanner_url'] ?? '')); $cl_scbanner_border_color = scdiscord_normalize_hex_color((string) ($_POST['cl_scbanner_border_color'] ?? '')); if ($cl_scbanner_name === '' || $cl_scbanner_url === '') { auth_flash_set('error', 'Le nom et le lien d’image de la bannière sont obligatoires.'); header('Location: scwebhook.php'); exit; } if (!filter_var($cl_scbanner_url, FILTER_VALIDATE_URL)) { auth_flash_set('error', 'L’URL de la bannière est invalide.'); header('Location: scwebhook.php'); exit; } try { if ($action === 'add_banner') { $stmt = $db->prepare('INSERT INTO tbl_scbanners (cl_scbanner_name, cl_scbanner_url, cl_scbanner_border_color) VALUES (:name, :url, :border_color)'); $stmt->execute([ 'name' => $cl_scbanner_name, 'url' => $cl_scbanner_url, 'border_color' => $cl_scbanner_border_color, ]); auth_flash_set('success', 'Bannière Discord ajoutée avec succès.'); } else { if ($banner_id <= 0) { throw new RuntimeException('ID de bannière invalide.'); } $stmt = $db->prepare('UPDATE tbl_scbanners SET cl_scbanner_name = :name, cl_scbanner_url = :url, cl_scbanner_border_color = :border_color WHERE cl_scbanner_id = :id'); $stmt->execute([ 'name' => $cl_scbanner_name, 'url' => $cl_scbanner_url, 'border_color' => $cl_scbanner_border_color, 'id' => $banner_id, ]); auth_flash_set('success', 'Bannière Discord mise à jour.'); } } catch (Throwable $e) { auth_flash_set('error', 'Erreur bannière : ' . $e->getMessage()); } header('Location: scwebhook.php'); exit; } if ($action === 'delete_banner') { $banner_id = (int) ($_POST['banner_id'] ?? 0); if ($banner_id > 0) { try { $stmt = $db->prepare('DELETE FROM tbl_scbanners WHERE cl_scbanner_id = :id'); $stmt->execute(['id' => $banner_id]); auth_flash_set('success', 'Bannière Discord supprimée.'); } catch (Throwable $e) { auth_flash_set('error', 'Erreur suppression bannière : ' . $e->getMessage()); } } header('Location: scwebhook.php'); exit; } } $stmt_webhooks = $db->query('SELECT * FROM tbl_scwebhooks ORDER BY cl_scwebhook_name ASC'); $webhooks = $stmt_webhooks->fetchAll(); $stmt_banners = $db->query('SELECT * FROM tbl_scbanners ORDER BY cl_scbanner_name ASC'); $banners = $stmt_banners->fetchAll(); ?> SC Webhook | R.E.A.C.T. Admin

R.E.A.C.T. SC Webhook

Niveau d'accès : Administrateur | Session :

Webhooks Discord enregistrés

Aucun webhook configuré pour le moment.
Nomination URL Type Actions

Bannières disponibles

Aucune bannière enregistrée pour le moment.
Nom Prévisualisation Couleur Actions