Files
NightSpire/web-next/sql/forum_fusion.sql
T
Inna af707ad98c Foro: reemplazar el foro anterior por el port del foro estilo FusionCMS
Se sustituye por completo el foro anterior de Next (que estaba vacío: 0 temas, 0
posts) por una adaptación del foro PHP de FusionCMS que tenía el usuario, con su
estructura, sus imágenes y su estética, llevadas a Next.

BASE DE DATOS (acore_web), esquema idéntico al original (sql/forum_fusion.sql):
  forum_categories(id, order, name)
  forum_forums(id, category, order, name, description, icon, colortitle, type)
  forum_topics(id, forum, name, sticky, locked, deleted, created)
  forum_posts(id, topic, poster, text, time, deleted)
Se hizo DROP de las tablas antiguas (forums, forum_categories, forum_topics,
forum_posts) y CREATE de estas, con el seed original (News/Reports/General,
foros con icono, clases con color, subforos por idioma con bandera). Única
diferencia con el dump: forum_topics.created, que faltaba y usan las vistas, y
el recorte del salto de línea final en los nombres de clase.

Los temas no guardan autor ni última actividad: se derivan del primer/último post,
como en el original. `poster` es el AccountID de acore_auth; el nombre se resuelve
al render (username sin el sufijo #N de Battle.net). El texto se guarda como HTML
saneado con nh3 (no BBCode) para encajar con el editor.

EDITOR: TinyMCE community self-hosted (licenseKey gpl), servido desde /tinymce
(scripts/copy-tinymce.mjs en postinstall; public/tinymce en .gitignore por ser
artefacto). El HTML se sanea SIEMPRE en el servidor.

PÁGINAS (app/[locale]/forum): índice con los 3 tipos de foro (fila normal, tarjeta
de clase tipo 1, tarjeta de idioma tipo 2), subforo, tema, crear y editar. La
lógica de forum.js (crear/responder/editar/moderar) se portó a fetch + los avisos
del sitio, sin jQuery/SweetAlert, y la moderación pasa por POST (no GET).

CSS: forum.css adaptado al tema (app/forum.css), rutas de imagen a /forum, dorado
alineado al acento del sitio (#d79602), y se aportan .nice_button/.main-wide/
.pagination que no estaban en theme.css.

ADMIN: lib/admin-forum.ts, sus rutas y AdminForumManager reescritos al esquema
nuevo (categoría, icono, color, tipo, orden; sin _en/visibility).

Se eliminan /forum/search y /forum/user (no existen en el foro nuevo) y los
componentes que quedaban huérfanos (ForumSearchBox, PostActions, TopicModBar,
NewTopicForm). i18n ES/EN completado (next-intl).

Verificado en producción: el índice renderiza en es/en con categorías, clases,
banderas e iconos; los assets y TinyMCE sirven 200; crear tema y responder guardan
las filas con el esquema correcto y las páginas las muestran (autor resuelto, HTML
saneado). Datos de prueba borrados: el foro arranca vacío.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 12:22:08 +00:00

105 lines
5.1 KiB
SQL

-- Foro estilo FusionCMS: reemplaza el esquema anterior del foro por el original.
-- Las tablas antiguas (forums, forum_categories, forum_topics, forum_posts) estaban
-- vacías de contenido (0 temas, 0 posts), así que no se pierde nada.
-- Idéntico al SQL original salvo:
-- * forum_topics.created timestamp NOT NULL DEFAULT (now()) (faltaba en el dump)
-- * nombres de clase sin el salto de línea final del dump original ('Druid\r\n' -> 'Druid')
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `forums`;
DROP TABLE IF EXISTS `forum_categories`;
DROP TABLE IF EXISTS `forum_forums`;
DROP TABLE IF EXISTS `forum_topics`;
DROP TABLE IF EXISTS `forum_posts`;
CREATE TABLE `forum_categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order` int(11) NOT NULL DEFAULT 0,
`name` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
CREATE TABLE `forum_forums` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`category` int(11) NOT NULL,
`order` int(11) NOT NULL DEFAULT 0,
`name` varchar(45) NOT NULL,
`description` text NOT NULL,
`icon` varchar(45) DEFAULT NULL,
`colortitle` varchar(45) DEFAULT NULL,
`type` int(11) NOT NULL DEFAULT 1,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
CREATE TABLE `forum_topics` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`forum` int(11) NOT NULL,
`name` varchar(45) NOT NULL,
`sticky` tinyint(4) NOT NULL DEFAULT 0,
`locked` tinyint(4) NOT NULL DEFAULT 0,
`deleted` tinyint(4) NOT NULL DEFAULT 0,
`created` timestamp NOT NULL DEFAULT (now()),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
CREATE TABLE `forum_posts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`topic` int(11) NOT NULL,
`poster` int(11) NOT NULL DEFAULT 0,
`text` text NOT NULL,
`time` timestamp NOT NULL DEFAULT current_timestamp(),
`deleted` tinyint(4) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO `forum_categories` (`id`, `order`, `name`) VALUES
(1, 1, 'News'),
(2, 2, 'Reports'),
(3, 3, 'General'),
(4, 4, 'Community Forums'),
(5, 5, 'Localized Forums'),
(6, 6, 'Class Discussions');
INSERT INTO `forum_forums` (`id`, `category`, `order`, `name`, `description`, `icon`, `colortitle`, `type`) VALUES
(1, 1, 0, 'Latest News', 'Latest news for the community.', 'forum_read', '0', 0),
(2, 1, 0, 'Rules and Regulations', 'Laws to abide by to keep your game experience intact.', 'forum_read', '0', 0),
(3, 2, 0, 'Appeal a Ban', 'Appeal a ban if you think you where wrongly banned.', 'forum_read', '0', 0),
(4, 2, 0, 'Report a Player', 'Report a player/s for breaking rules in-game.', 'forum_read', '0', 0),
(5, 2, 0, 'Report a Gm/Dev', 'Report a Gm/Dev.', 'forum_read', '0', 0),
(6, 3, 0, 'General Discussion', 'For anything and everything this server related.', 'forum_read', '0', 0),
(7, 3, 0, 'Suggestions', 'Give us your thoughts on anything to do with the server.', 'forum_read', '0', 0),
(8, 3, 0, 'Guides & Tutorials', 'Create guides to help the community.', 'forum_read', '0', 0),
(9, 3, 0, 'Support & Q/A', 'Having trouble with something or just want to help players out?', 'forum_read', '0', 0),
(10, 3, 0, 'Addons', 'Helpful and interesting Addons.', 'forum_read', '0', 0),
(11, 3, 0, 'Guild Recruitment', '', 'forum_read', '0', 0),
(12, 4, 0, 'Introduce Yourself', 'New player? Tell us a bit about yourself.', 'forum_read', '0', 0),
(13, 4, 0, 'Dungeons and Raids', 'Everything about raiding, organization and shared experience.', 'forum_read', '0', 0),
(14, 4, 0, 'World PvP, Arenas & Battlegrounds', 'Discuss builds, city raids, arenas and battlegrounds.', 'forum_read', '0', 0),
(15, 4, 0, 'Specific Discussions', 'Discussion about your favorite Faction, Roleplay and ...', 'forum_read', '0', 0),
(16, 5, 0, 'English', '', '/forum/flags2/en.svg', '0', 2),
(17, 5, 0, 'Persian', '', '/forum/flags2/ir.svg', '0', 2),
(18, 5, 0, 'Romania', '', '/forum/flags2/ro.svg', '0', 2),
(19, 5, 0, 'Russian', '', '/forum/flags2/ru.svg', '0', 2),
(20, 5, 0, 'Bulgaria', '', '/forum/flags2/bg.svg', '0', 2),
(21, 5, 0, 'Spanish', '', '/forum/flags2/es.svg', '0', 2),
(22, 5, 0, 'French', '', '/forum/flags2/fr.svg', '0', 2),
(23, 5, 0, 'German', '', '/forum/flags2/de.svg', '0', 2),
(24, 5, 0, 'Italian', '', '/forum/flags2/it.svg', '0', 2),
(25, 5, 0, 'Polish', '', '/forum/flags2/pl.svg', '0', 2),
(26, 6, 0, 'Death Knight', '', 'deathknight', '#C41E3A', 1),
(27, 6, 0, 'Demon Hunter', '', 'demonhunter', '#A330C9', 1),
(28, 6, 0, 'Druid', '', 'druid', '#FF7C0A', 1),
(29, 6, 0, 'Evoker', '', 'evoker', '#33937F', 1),
(30, 6, 0, 'Hunter', '', 'hunter', '#AAD372', 1),
(31, 6, 0, 'Mage', '', 'mage', '#3FC7EB', 1),
(32, 6, 0, 'Monk', '', 'monk', '#00FF98', 1),
(33, 6, 0, 'Paladin', '', 'paladin', '#F48CBA', 1),
(34, 6, 0, 'Priest', '', 'priest', '#FFFFFF', 1),
(35, 6, 0, 'Rogue', '', 'rogue', '#FFF468', 1),
(36, 6, 0, 'Shaman', '', 'shaman', '#0070DD', 1),
(37, 6, 0, 'Warlock', '', 'warlock', '#8788EE', 1),
(38, 6, 0, 'Warrior', '', 'warrior', '#C69B6D', 1);
SET FOREIGN_KEY_CHECKS = 1;