diff --git a/admin/languages.php b/admin/languages.php index 94c10f1..7ec90de 100755 --- a/admin/languages.php +++ b/admin/languages.php @@ -83,6 +83,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) { } catch (Exception $e) { $syncError = "Error al conectar con LibreTranslate: " . $e->getMessage() . ". Verifica que el servicio esté configurado correctamente en el archivo .env"; } + + } elseif ($action === 'toggle_telegram') { + $id = (int) $_POST['id']; + $stmt = $pdo->prepare("UPDATE supported_languages SET telegram_enabled = NOT telegram_enabled WHERE id = ? AND is_active = TRUE"); + $stmt->execute([$id]); + logActivity(getCurrentUserId(), 'toggle_telegram_language', "Idioma Telegram ID: $id"); + header('Location: languages.php'); + exit; + + } elseif ($action === 'toggle_discord') { + $id = (int) $_POST['id']; + $stmt = $pdo->prepare("UPDATE supported_languages SET discord_enabled = NOT discord_enabled WHERE id = ? AND is_active = TRUE"); + $stmt->execute([$id]); + logActivity(getCurrentUserId(), 'toggle_discord_language', "Idioma Discord ID: $id"); + header('Location: languages.php'); + exit; } } @@ -294,6 +310,8 @@ require_once __DIR__ . '/../templates/header.php';