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>
This commit is contained in:
2026-07-16 12:22:08 +00:00
parent 0f98b754d4
commit af707ad98c
190 changed files with 3142 additions and 1104 deletions
+82 -45
View File
@@ -1,17 +1,19 @@
import { notFound } from 'next/navigation'
import { getTranslations, setRequestLocale } from 'next-intl/server'
import { Link } from '@/i18n/navigation'
import { getForum, getTopics, countTopics } from '@/lib/forum'
import { getForum, getForumPath, countTopics, getTopics, resolvePosters } from '@/lib/forum'
import { formatForumDate } from '@/lib/forum-format'
import { getSession } from '@/lib/session'
import { forumIsModerator } from '@/lib/forum-perm'
import { PageShell } from '@/components/PageShell'
import { NewTopicForm } from '@/components/NewTopicForm'
import { ForumBreadcrumb } from '@/components/ForumBreadcrumb'
import { Pagination } from '@/components/Pagination'
export const dynamic = 'force-dynamic'
const PER_PAGE = 20
const PER_PAGE = 10
export default async function ForumPage({
export default async function SubforumPage({
params,
searchParams,
}: {
@@ -23,58 +25,93 @@ export default async function ForumPage({
const t = await getTranslations('Forum')
const id = Number(forumId)
const forum = await getForum(id, locale)
const forum = await getForum(id)
if (!forum) notFound()
const session = await getSession()
const isMod = await forumIsModerator(session)
const canCreate = Boolean(session.username)
const total = await countTopics(id)
const totalPages = Math.max(1, Math.ceil(total / PER_PAGE))
const page = Math.min(Math.max(1, Number((await searchParams).page) || 1), totalPages)
const topics = await getTopics(id, (page - 1) * PER_PAGE, PER_PAGE)
const session = await getSession()
const canPost = Boolean(session.username)
const topics = await getTopics(id, (page - 1) * PER_PAGE, PER_PAGE, isMod)
const posters = await resolvePosters(
topics.flatMap((tp) => [tp.poster, tp.last_poster].filter(Boolean) as number[]),
)
const name = (pid: number | null) => (pid != null ? posters.get(pid)?.name ?? `#${pid}` : '')
const path = await getForumPath(id)
const hrefFor = (p: number) => `/forum/${id}?page=${p}`
return (
<PageShell title={forum!.name}>
<div className="box-content">
<div className="body-box-content">
<p>
<Link href="/forum"> {t('backToForum')}</Link>
</p>
{forum!.description && <p className="second-brown">{forum!.description}</p>}
<br />
<PageShell title={forum.name}>
<div className="main-wide">
{path && <ForumBreadcrumb items={[{ label: t('title'), href: '/forum' }, { label: path.forum }]} />}
<div className="forum-padding">
<div className="forum_header">
<div className="forum_title">
<h1>{forum.name}</h1>
{forum.description && <h3>{forum.description}</h3>}
</div>
<h4>
<b>{total}</b> {t('topics')}
</h4>
</div>
<div className="actions_c">
{canCreate ? (
<Link href={`/forum/create/${id}`} className="nice_button">
{t('createTopic')}
</Link>
) : (
<span />
)}
<Pagination page={page} totalPages={totalPages} hrefFor={hrefFor} />
</div>
{topics.length === 0 ? (
<p className="second-brown centered">{t('noTopics')}</p>
<h2 className="forum-empty">{t('noTopics')}</h2>
) : (
<table className="max-center-table">
<tbody>
{topics.map((topic) => (
<tr key={topic.id} className="team-center-table-tr">
<td className="lefted separate">
<Link href={`/forum/topic/${topic.id}`} className="yellow-info">
{topic.sticky && <span className="second-yellow small-font">[{t('sticky')}] </span>}
{topic.locked && <span className="red-info2 small-font">[{t('locked')}] </span>}
{topic.name}
</Link>
<p className="third-brown small-font">
{t('by')} {topic.poster}
</p>
</td>
<td className="real-info-box no-wrap-td second-brown small-font">
{topic.views} {t('views')}
</td>
</tr>
))}
</tbody>
</table>
topics.map((tp) => (
<ul className="topic_row" key={tp.id}>
<li className="icon">
<img
src={`/forum/forum_icons/topic_${tp.locked ? 'read_locked' : tp.deleted ? 'read_mine' : 'unread'}.png`}
height={39}
width={55}
alt=""
/>
</li>
<li className="topic_title_by_date">
<h1>
<Link href={`/forum/topic/${tp.id}`}>
{tp.deleted && `[${t('deleted')}] `}
{tp.sticky && `[${t('sticky')}] `}
{tp.locked && `[${t('locked')}] `}
{tp.name}
</Link>
</h1>
<p>
{t('createdBy')} <span className="username">{name(tp.poster)}</span>,{' '}
{formatForumDate(tp.created, locale)}
</p>
</li>
<li className="lastpost">
<h4>
{t('by')} {name(tp.last_poster)}
</h4>
<h5>{formatForumDate(tp.time_updated, locale)}</h5>
</li>
</ul>
))
)}
<Pagination page={page} totalPages={totalPages} hrefFor={(p) => `/forum/${id}?page=${p}`} />
{canPost ? (
<NewTopicForm forumId={id} />
) : (
<p className="second-brown centered separate">{t('loginToPost')}</p>
)}
<div className="actions_c" style={{ marginTop: 20 }}>
<span />
<Pagination page={page} totalPages={totalPages} hrefFor={hrefFor} />
</div>
</div>
</div>
</PageShell>
@@ -0,0 +1,51 @@
import { notFound, redirect } from 'next/navigation'
import { getTranslations, setRequestLocale } from 'next-intl/server'
import { getForum, getForumPath } from '@/lib/forum'
import { getSession } from '@/lib/session'
import { PageShell } from '@/components/PageShell'
import { ForumBreadcrumb } from '@/components/ForumBreadcrumb'
import { CreateTopicForm } from '@/components/CreateTopicForm'
export const dynamic = 'force-dynamic'
export default async function CreateTopicPage({
params,
}: {
params: Promise<{ locale: string; forumId: string }>
}) {
const { locale, forumId } = await params
setRequestLocale(locale)
const t = await getTranslations('Forum')
const id = Number(forumId)
const forum = await getForum(id)
if (!forum) notFound()
const session = await getSession()
if (!session.username) redirect(`/${locale}/forum/${id}`)
const path = await getForumPath(id)
return (
<PageShell title={t('createTopic')}>
<div className="main-wide">
{path && (
<ForumBreadcrumb
items={[
{ label: t('title'), href: '/forum' },
{ label: path.forum, href: `/forum/${id}` },
{ label: t('createTopic') },
]}
/>
)}
<div className="forum_header create_header">
<div className="forum_title">
<h1>{forum.name}</h1>
{forum.description && <h3>{forum.description}</h3>}
</div>
</div>
<CreateTopicForm forumId={id} />
</div>
</PageShell>
)
}
@@ -0,0 +1,58 @@
import { notFound, redirect } from 'next/navigation'
import { getTranslations, setRequestLocale } from 'next-intl/server'
import { getPost } from '@/lib/forum-write'
import { getTopic, getTopicPath } from '@/lib/forum'
import { getSession } from '@/lib/session'
import { forumIsModerator, canEditPost } from '@/lib/forum-perm'
import { PageShell } from '@/components/PageShell'
import { ForumBreadcrumb } from '@/components/ForumBreadcrumb'
import { EditPostPageForm } from '@/components/EditPostPageForm'
export const dynamic = 'force-dynamic'
export default async function EditPostPage({
params,
}: {
params: Promise<{ locale: string; postId: string }>
}) {
const { locale, postId } = await params
setRequestLocale(locale)
const t = await getTranslations('Forum')
const id = Number(postId)
const post = await getPost(id)
if (!post) notFound()
const session = await getSession()
if (!session.username) redirect(`/${locale}/forum/topic/${post.topic}`)
const isMod = await forumIsModerator(session)
if (!canEditPost(session, isMod, post.poster)) redirect(`/${locale}/forum/topic/${post.topic}`)
const topic = await getTopic(post.topic, true)
const path = await getTopicPath(post.topic)
return (
<PageShell title={t('editPost')}>
<div className="main-wide">
{path && (
<ForumBreadcrumb
items={[
{ label: t('title'), href: '/forum' },
{ label: path.forum, href: `/forum/${path.forum_id}` },
{ label: path.topic, href: `/forum/topic/${post.topic}` },
{ label: t('editPost') },
]}
/>
)}
<div className="forum_header create_header">
<div className="forum_title">
<h1>{topic?.name}</h1>
{path && <h3>{path.forum}</h3>}
</div>
</div>
<EditPostPageForm postId={id} topicId={post.topic} initialText={post.text} />
</div>
</PageShell>
)
}
+6
View File
@@ -0,0 +1,6 @@
import '@/app/forum.css'
// Carga el CSS del foro solo bajo /forum (todas sus subrutas heredan este layout).
export default function ForumLayout({ children }: { children: React.ReactNode }) {
return children
}
+112 -44
View File
@@ -1,8 +1,8 @@
import { getTranslations, setRequestLocale } from 'next-intl/server'
import { Link } from '@/i18n/navigation'
import { getForumIndex } from '@/lib/forum'
import { getForumIndex, resolvePosters, type ForumRow } from '@/lib/forum'
import { formatForumDate } from '@/lib/forum-format'
import { PageShell } from '@/components/PageShell'
import { ForumSearchBox } from '@/components/ForumSearchBox'
export const dynamic = 'force-dynamic'
@@ -10,53 +10,121 @@ export default async function ForumIndexPage({ params }: { params: Promise<{ loc
const { locale } = await params
setRequestLocale(locale)
const t = await getTranslations('Forum')
const categories = await getForumIndex(locale)
const categories = await getForumIndex()
// Nombres de los últimos posteadores de todos los foros, en una sola consulta.
const posterIds = categories.flatMap((c) => c.forums.map((f) => f.last_poster).filter(Boolean) as number[])
const posters = await resolvePosters(posterIds)
function topicsLabel(n: number) {
return `${n} ${n === 1 ? t('topic') : t('topics')}`
}
function NormalRow({ f }: { f: ForumRow }) {
const iconSrc = f.type === 3 ? f.icon || '' : `/forum/forum_icons/${f.icon || 'forum_read'}.png`
return (
<div className="forum-row">
<div className="icon">
<Link href={`/forum/${f.id}`}>
<img src={iconSrc} height={53} width={56} alt={f.name} />
</Link>
</div>
<div className="forum_title_desc">
<Link href={`/forum/${f.id}`}>
<h1 style={f.colortitle && f.colortitle !== '0' ? { color: f.colortitle } : undefined}>{f.name}</h1>
{f.description && <h2>{f.description}</h2>}
</Link>
</div>
<div className="post" title={t('posts')}>
<p>{f.post_count}</p>
</div>
<div className="topics" title={t('topics')}>
<p>{f.topic_count}</p>
</div>
{f.last_topic_id && (
<div className="lastpost">
<p className="topic_title">
<Link href={`/forum/topic/${f.last_topic_id}`}>{f.last_topic_name}</Link>
</p>
{f.last_poster != null && (
<p className="by">{posters.get(f.last_poster)?.name ?? `#${f.last_poster}`}</p>
)}
<p className="postdate">{formatForumDate(f.last_time, locale)}</p>
</div>
)}
</div>
)
}
function ClassTile({ f }: { f: ForumRow }) {
return (
<div className={`class-row ${f.icon ?? ''}`}>
<div className="icon">
<Link href={`/forum/${f.id}`}>
<div className="image_icon" />
</Link>
</div>
<div className="info">
<Link href={`/forum/${f.id}`}>
<h1 style={f.colortitle && f.colortitle !== '0' ? { color: f.colortitle } : undefined}>{f.name}</h1>
<h2>{topicsLabel(f.topic_count)}</h2>
</Link>
</div>
</div>
)
}
function FlagTile({ f }: { f: ForumRow }) {
return (
<div className="class-row">
<div className="icon">
<Link href={`/forum/${f.id}`}>
<img className="image_icon" src={f.icon || ''} height={36} width={36} alt={f.name} />
</Link>
</div>
<div className="info">
<Link href={`/forum/${f.id}`}>
<h1>{f.name}</h1>
<h2>{topicsLabel(f.topic_count)}</h2>
</Link>
</div>
</div>
)
}
return (
<PageShell title={t('title')}>
<div className="box-content">
<div className="body-box-content">
<ForumSearchBox />
{categories.length === 0 ? (
<p className="second-brown centered">{t('noForums')}</p>
) : (
categories.map((cat) => (
<div key={cat.id}>
<div className="title-content-h3">
<h3 className="big-font">{cat.name}</h3>
<div className="forum-container">
{categories.length === 0 ? (
<p className="forum-empty">{t('noForums')}</p>
) : (
categories.map((cat) => {
const tiles = cat.forums.filter((f) => f.type === 1 || f.type === 2)
const rows = cat.forums.filter((f) => f.type !== 1 && f.type !== 2)
return (
<div key={cat.id} className="forum-category" style={{ marginBottom: 40 }}>
<div className="category-title">{cat.name}</div>
{tiles.length > 0 && (
<div
style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))',
gap: 12,
marginBottom: rows.length ? 12 : 0,
}}
>
{tiles.map((f) => (f.type === 1 ? <ClassTile key={f.id} f={f} /> : <FlagTile key={f.id} f={f} />))}
</div>
)}
<div style={{ display: 'grid', gap: 8 }}>
{rows.map((f) => (
<NormalRow key={f.id} f={f} />
))}
</div>
<table className="max-center-table">
<tbody>
{cat.forums.map((f) => (
<tr key={f.id} className="team-center-table-tr">
<td className="lefted separate">
<Link href={`/forum/${f.id}`} className="yellow-info">
{f.name}
</Link>
{f.description && <p className="second-brown small-font">{f.description}</p>}
</td>
<td className="real-info-box no-wrap-td">
<span className="second-brown small-font">
{f.topic_count} {t('topics')} · {f.post_count} {t('posts')}
</span>
{f.last_topic_id && (
<p className="small-font">
<Link href={`/forum/topic/${f.last_topic_id}`}>{f.last_topic_name}</Link>{' '}
<span className="third-brown">
{t('by')} {f.last_topic_poster}
</span>
</p>
)}
</td>
</tr>
))}
</tbody>
</table>
<br />
</div>
))
)}
</div>
)
})
)}
</div>
</PageShell>
)
@@ -1,70 +0,0 @@
import { getTranslations, setRequestLocale } from 'next-intl/server'
import { Link } from '@/i18n/navigation'
import { searchTopics, countSearchTopics } from '@/lib/forum'
import { PageShell } from '@/components/PageShell'
import { ForumSearchBox } from '@/components/ForumSearchBox'
export const dynamic = 'force-dynamic'
export default async function ForumSearchPage({
params,
searchParams,
}: {
params: Promise<{ locale: string }>
searchParams: Promise<{ q?: string }>
}) {
const { locale } = await params
setRequestLocale(locale)
const { q } = await searchParams
const query = (q ?? '').trim()
const t = await getTranslations('Forum')
const valid = query.length >= 2
const results = valid ? await searchTopics(query, 0, 30) : []
const total = valid ? await countSearchTopics(query) : 0
return (
<PageShell title={t('search')}>
<div className="box-content">
<div className="body-box-content">
<p>
<Link href="/forum"> {t('backToForum')}</Link>
</p>
<br />
<ForumSearchBox initial={query} />
{!valid ? (
<p className="second-brown centered">{t('searchHint')}</p>
) : results.length === 0 ? (
<p className="second-brown centered">{t('noResults', { query })}</p>
) : (
<>
<p className="second-brown">{t('resultsCount', { count: total, query })}</p>
<table className="max-center-table">
<tbody>
{results.map((r) => (
<tr key={r.id} className="team-center-table-tr">
<td className="lefted separate">
<Link href={`/forum/topic/${r.id}`} className="yellow-info">
{r.name}
</Link>
<p className="third-brown small-font">
{t('in')} <Link href={`/forum/${r.forum_id}`}>{r.forum_name}</Link> · {t('by')} {r.poster}
</p>
</td>
{r.updated_at && (
<td className="real-info-box no-wrap-td third-brown small-font">
{new Date(r.updated_at).toLocaleDateString(locale)}
</td>
)}
</tr>
))}
</tbody>
</table>
</>
)}
</div>
</div>
</PageShell>
)
}
@@ -1,18 +1,26 @@
import { notFound } from 'next/navigation'
import { getTranslations, setRequestLocale } from 'next-intl/server'
import { Link } from '@/i18n/navigation'
import { getTopic, getPosts, countPosts, listForumsForMove } from '@/lib/forum'
import {
getTopic,
getTopicPath,
getPosts,
countPosts,
resolvePosters,
getUserPostCount,
} from '@/lib/forum'
import { formatForumDate } from '@/lib/forum-format'
import { getSession } from '@/lib/session'
import { forumIsModerator, canEditPost } from '@/lib/forum-perm'
import { PageShell } from '@/components/PageShell'
import { ReplyForm } from '@/components/ReplyForm'
import { PostActions } from '@/components/PostActions'
import { TopicModBar } from '@/components/TopicModBar'
import { ForumBreadcrumb } from '@/components/ForumBreadcrumb'
import { Pagination } from '@/components/Pagination'
import { ReplyForm } from '@/components/ReplyForm'
import { EditPostForm } from '@/components/EditPostForm'
import { ForumModActions } from '@/components/ForumModActions'
export const dynamic = 'force-dynamic'
const PER_PAGE = 15
const PER_PAGE = 5
export default async function TopicPage({
params,
@@ -30,77 +38,136 @@ export default async function TopicPage({
const isMod = await forumIsModerator(session)
const topic = await getTopic(id, isMod)
if (!topic) notFound()
const total = await countPosts(id, isMod)
const totalPages = Math.max(1, Math.ceil(total / PER_PAGE))
const page = Math.min(Math.max(1, Number((await searchParams).page) || 1), totalPages)
const posts = await getPosts(id, (page - 1) * PER_PAGE, PER_PAGE, isMod)
const moveForums = isMod ? (await listForumsForMove()).filter((f) => f.id !== topic!.forum_id) : []
const canReply = Boolean(session.username) && (!topic!.locked || isMod)
const title = (
<>
{topic!.sticky && <span className="second-yellow">[{t('pinned')}] </span>}
{topic!.locked && <span className="red-info2">[{t('locked')}] </span>}
{topic!.deleted && <span className="red-info2">[{t('deletedMark')}] </span>}
{topic!.name}
</>
const posters = await resolvePosters(posts.map((p) => p.poster))
// Nº de posts por autor visible (para el panel lateral), en paralelo.
const uniquePosters = [...new Set(posts.map((p) => p.poster))]
const counts = new Map<number, number>(
await Promise.all(uniquePosters.map(async (pid) => [pid, await getUserPostCount(pid)] as const)),
)
const path = await getTopicPath(id)
const canReply = Boolean(session.username) && (!topic.locked || isMod)
return (
<PageShell title={title}>
<div className="box-content">
<div className="body-box-content">
<p>
<Link href="/forum"> {t('backToForum')}</Link>
</p>
<br />
<PageShell
title={
<>
{topic.sticky && `[${t('sticky')}] `}
{topic.locked && `[${t('locked')}] `}
{topic.deleted && `[${t('deleted')}] `}
{topic.name}
</>
}
>
<div className="main-wide">
{path && (
<ForumBreadcrumb
items={[
{ label: t('title'), href: '/forum' },
{ label: path.forum, href: `/forum/${path.forum_id}` },
{ label: path.topic },
]}
/>
)}
{isMod && (
<TopicModBar
topicId={id}
locked={topic!.locked}
sticky={topic!.sticky}
deleted={topic!.deleted}
moveForums={moveForums}
/>
)}
{posts.map((post) => (
<div key={post.id} className="inline-div" style={{ display: 'block', opacity: post.deleted ? 0.5 : 1 }}>
<div className="lefted">
<span className="yellow-info">
<Link href={`/forum/user/${encodeURIComponent(post.poster)}`}>{post.poster}</Link>
{post.deleted && <span className="red-info2 small-font"> [{t('deletedMark')}]</span>}
</span>
{post.time && (
<span className="date third-brown small-font">
{new Date(post.time).toLocaleString(locale)}
{post.edited && <span className="grey-info2"> · {t('editedMark')}</span>}
</span>
)}
</div>
<hr />
<div className="post-content" dangerouslySetInnerHTML={{ __html: post.text }} />
{canEditPost(session, isMod, post.poster_id) && (
<PostActions postId={post.id} initialText={post.text} deleted={post.deleted} />
)}
</div>
))}
<Pagination page={page} totalPages={totalPages} hrefFor={(p) => `/forum/topic/${id}?page=${p}`} />
{canReply ? (
page === totalPages ? (
<ReplyForm topicId={id} />
) : (
<p className="separate">
<Link href={`/forum/topic/${id}?page=${totalPages}`}>{t('replyOnLastPage')}</Link>
</p>
)
) : (
!session.username && <p className="second-brown centered separate">{t('loginToPost')}</p>
)}
<div className="topic_header">
<div className="topic_title">
<h1>{topic.name}</h1>
<h3>{formatForumDate(topic.created, locale)}</h3>
</div>
<h4>
<b>{total}</b> {t('posts')}
</h4>
</div>
<div className="actions_c">
<span />
<Pagination page={page} totalPages={totalPages} hrefFor={(p) => `/forum/topic/${id}?page=${p}`} />
</div>
{posts.map((post) => {
const author = posters.get(post.poster)
const isStaff = author?.isStaff ?? false
return (
<div key={post.id} className={`topic_post${isStaff ? ' isStaff' : ''}${post.deleted ? ' post_deleted' : ''}`}>
<div className="left_side">
<div className="username_container">
<span className="username">{author?.name ?? `#${post.poster}`}</span>
</div>
<div className={`user_avatar${isStaff ? ' isStaff' : ''}`}>
<span />
</div>
<div className="user_info">
<h3 className="post_field">
<dt>
<i className="fa-solid fa-user-shield fa-fw" />
</dt>
<dd className={isStaff ? 'badge_staff' : undefined}>{isStaff ? t('staff') : t('member')}</dd>
</h3>
<h3 className="post_field">
<dt>
<i className="fa-solid fa-calendar fa-fw" />
</dt>
<dd>{formatForumDate(author?.joindate ?? null, locale) || '—'}</dd>
</h3>
<h3 className="post_field">
<dt>
<i className="fa-solid fa-comments fa-fw" />
</dt>
<dd>
{t('posts')}: {counts.get(post.poster) ?? 0}
</dd>
</h3>
</div>
</div>
<div className="right_side">
<div className="post_container" dangerouslySetInnerHTML={{ __html: post.text }} />
<ul className="post_controls">
<li className="post_date">{formatForumDate(post.time, locale)}</li>
{canEditPost(session, isMod, post.poster) && (
<li>
<EditPostForm postId={post.id} initialText={post.text} />
</li>
)}
{isMod && (
<li>
<ForumModActions kind="post" id={post.id} deleted={post.deleted} />
</li>
)}
</ul>
</div>
</div>
)
})}
<div className="actions_c">
<span />
<Pagination page={page} totalPages={totalPages} hrefFor={(p) => `/forum/topic/${id}?page=${p}`} />
</div>
{isMod && (
<div className="forum-form-actions" style={{ marginBottom: 20 }}>
<ForumModActions kind="topic" id={id} deleted={topic.deleted} locked={topic.locked} />
</div>
)}
{canReply ? (
page === totalPages ? (
<ReplyForm topicId={id} />
) : (
<p className="forum-empty">
<a href={`/forum/topic/${id}?page=${totalPages}`}>{t('replyOnLastPage')}</a>
</p>
)
) : (
!session.username && <p className="forum-empty">{t('loginToPost')}</p>
)}
</div>
</PageShell>
)
@@ -1,83 +0,0 @@
import { getTranslations, setRequestLocale } from 'next-intl/server'
import { Link } from '@/i18n/navigation'
import { getForumProfile } from '@/lib/forum'
import { PageShell } from '@/components/PageShell'
export const dynamic = 'force-dynamic'
export default async function ForumProfilePage({
params,
}: {
params: Promise<{ locale: string; username: string }>
}) {
const { locale, username } = await params
setRequestLocale(locale)
const t = await getTranslations('Forum')
const p = await getForumProfile(decodeURIComponent(username))
const title = (
<>
{p.username}
{p.status && (
<span className="second-yellow small-font"> [{p.status === 'admin' ? t('roleAdmin') : t('roleGm')}]</span>
)}
</>
)
return (
<PageShell title={title}>
<div className="box-content">
<div className="body-box-content">
<p>
<Link href="/forum"> {t('backToForum')}</Link>
</p>
<br />
<table className="max-center-table info-box-light">
<tbody>
<tr>
<td className="centered separate">
<span className="second-brown">{t('posts')}</span>
<br />
<span className="yellow-info big-font">{p.postCount}</span>
</td>
<td className="centered separate">
<span className="second-brown">{t('topics')}</span>
<br />
<span className="yellow-info big-font">{p.topicCount}</span>
</td>
<td className="centered separate">
<span className="second-brown">{t('memberSince')}</span>
<br />
<span className="yellow-info">
{p.joindate ? new Date(p.joindate).toLocaleDateString(locale) : '—'}
</span>
</td>
</tr>
</tbody>
</table>
{p.recentTopics.length > 0 && (
<>
<div className="title-content-h3">
<h3 className="big-font">{t('recentTopics')}</h3>
</div>
<table className="max-center-table">
<tbody>
{p.recentTopics.map((topic) => (
<tr key={topic.id} className="team-center-table-tr">
<td className="lefted separate">
<Link href={`/forum/topic/${topic.id}`} className="yellow-info">
{topic.name}
</Link>
</td>
</tr>
))}
</tbody>
</table>
</>
)}
</div>
</div>
</PageShell>
)
}
+19 -22
View File
@@ -1,23 +1,13 @@
import { getSession } from '@/lib/session'
import { isAdmin } from '@/lib/admin'
import { deleteForum, setForumVisibility, updateForum } from '@/lib/admin-forum'
import { deleteForum, updateForum } from '@/lib/admin-forum'
export async function DELETE(_request: Request, { params }: { params: Promise<{ id: string }> }) {
const session = await getSession()
if (!(await isAdmin(session))) return Response.json({ success: false, error: 'forbidden' }, { status: 403 })
const { id } = await params
await deleteForum(Number(id))
return Response.json({ success: true })
}
export async function PATCH(request: Request, { params }: { params: Promise<{ id: string }> }) {
const session = await getSession()
if (!(await isAdmin(session))) return Response.json({ success: false, error: 'forbidden' }, { status: 403 })
const { id } = await params
let b: Record<string, unknown> = {}
try { b = await request.json() } catch { return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 }) }
await setForumVisibility(Number(id), b.visibility !== false)
return Response.json({ success: true })
const ok = await deleteForum(Number(id))
return Response.json({ success: ok, error: ok ? undefined : 'forumNotEmpty' })
}
export async function PUT(request: Request, { params }: { params: Promise<{ id: string }> }) {
@@ -25,14 +15,21 @@ export async function PUT(request: Request, { params }: { params: Promise<{ id:
if (!(await isAdmin(session))) return Response.json({ success: false, error: 'forbidden' }, { status: 403 })
const { id } = await params
let b: Record<string, unknown> = {}
try { b = await request.json() } catch { return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 }) }
const name = String(b.name ?? '').trim()
const nameEn = String(b.nameEn ?? '').trim() || null
const description = String(b.description ?? '').trim()
const descriptionEn = String(b.descriptionEn ?? '').trim() || null
const order = Number(b.order) || 0
const visibility = b.visibility === false ? 0 : 1
if (!name) return Response.json({ success: false, error: 'emptyError' })
await updateForum(Number(id), name, nameEn, description, descriptionEn, order, visibility)
try {
b = await request.json()
} catch {
return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
}
const f = {
category: Number(b.category),
name: String(b.name ?? '').trim(),
description: String(b.description ?? '').trim(),
icon: String(b.icon ?? '').trim() || null,
colortitle: String(b.colortitle ?? '').trim() || null,
type: Number(b.type) || 0,
order: Number(b.order) || 0,
}
if (!f.category || !f.name) return Response.json({ success: false, error: 'emptyError' })
await updateForum(Number(id), f)
return Response.json({ success: true })
}
@@ -15,11 +15,14 @@ export async function PUT(request: Request, { params }: { params: Promise<{ id:
if (!(await isAdmin(session))) return Response.json({ success: false, error: 'forbidden' }, { status: 403 })
const { id } = await params
let b: Record<string, unknown> = {}
try { b = await request.json() } catch { return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 }) }
try {
b = await request.json()
} catch {
return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
}
const name = String(b.name ?? '').trim()
const nameEn = String(b.nameEn ?? '').trim() || null
const order = Number(b.order) || 0
if (!name) return Response.json({ success: false, error: 'emptyError' })
await updateCategory(Number(id), name, nameEn, order)
await updateCategory(Number(id), name, order)
return Response.json({ success: true })
}
@@ -6,11 +6,14 @@ export async function POST(request: Request) {
const session = await getSession()
if (!(await isAdmin(session))) return Response.json({ success: false, error: 'forbidden' }, { status: 403 })
let b: Record<string, unknown> = {}
try { b = await request.json() } catch { return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 }) }
try {
b = await request.json()
} catch {
return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
}
const name = String(b.name ?? '').trim()
const nameEn = String(b.nameEn ?? '').trim() || null
const order = Number(b.order) || 0
if (!name) return Response.json({ success: false, error: 'emptyError' })
const id = await createCategory(name, nameEn, order)
const id = await createCategory(name, order)
return Response.json({ success: true, id })
}
+16 -10
View File
@@ -6,15 +6,21 @@ export async function POST(request: Request) {
const session = await getSession()
if (!(await isAdmin(session))) return Response.json({ success: false, error: 'forbidden' }, { status: 403 })
let b: Record<string, unknown> = {}
try { b = await request.json() } catch { return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 }) }
const categoryId = Number(b.categoryId)
const name = String(b.name ?? '').trim()
const nameEn = String(b.nameEn ?? '').trim() || null
const description = String(b.description ?? '').trim()
const descriptionEn = String(b.descriptionEn ?? '').trim() || null
const order = Number(b.order) || 0
const visibility = b.visibility === false ? 0 : 1
if (!categoryId || !name) return Response.json({ success: false, error: 'emptyError' })
const id = await createForum(categoryId, name, nameEn, description, descriptionEn, order, visibility)
try {
b = await request.json()
} catch {
return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
}
const f = {
category: Number(b.category),
name: String(b.name ?? '').trim(),
description: String(b.description ?? '').trim(),
icon: String(b.icon ?? '').trim() || null,
colortitle: String(b.colortitle ?? '').trim() || null,
type: Number(b.type) || 0,
order: Number(b.order) || 0,
}
if (!f.category || !f.name) return Response.json({ success: false, error: 'emptyError' })
const id = await createForum(f)
return Response.json({ success: true, id })
}
+35 -36
View File
@@ -1,55 +1,54 @@
import { getSession } from '@/lib/session'
import { getTopic, getForum } from '@/lib/forum'
import { setTopicFlag, moveTopic } from '@/lib/forum-write'
import { getTopic } from '@/lib/forum'
import { getPost, setTopicFlag, setPostDeleted } from '@/lib/forum-write'
import { forumIsModerator } from '@/lib/forum-perm'
type Action = 'lock' | 'unlock' | 'sticky' | 'unsticky' | 'delete' | 'restore' | 'move'
/** Moderación de temas: bloquear, fijar, borrar. Solo moderadores. */
/**
* Moderación del foro (solo moderadores), por POST para no mutar con GET.
* kind='post' → action: delete | undelete
* kind='topic' → action: delete | undelete | lock | unlock
*/
export async function POST(request: Request) {
const session = await getSession()
if (!session.accountId) return Response.json({ success: false, error: 'notAuthenticated' }, { status: 401 })
if (!(await forumIsModerator(session))) return Response.json({ success: false, error: 'forbidden' }, { status: 403 })
let b: Record<string, string> = {}
try { b = await request.json() } catch { return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 }) }
const topicId = Number(b.topicId)
const action = String(b.action ?? '') as Action
if (!topicId) return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
try {
b = await request.json()
} catch {
return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
}
const kind = String(b.kind ?? '')
const id = Number(b.id)
const action = String(b.action ?? '')
if (!id || (kind !== 'post' && kind !== 'topic'))
return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
const topic = await getTopic(topicId, true) // incluye borrados (ya verificado que es mod)
if (kind === 'post') {
const post = await getPost(id)
if (!post) return Response.json({ success: false, error: 'postNotFound' }, { status: 404 })
if (action === 'delete') await setPostDeleted(id, true)
else if (action === 'undelete') await setPostDeleted(id, false)
else return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
return Response.json({ success: true })
}
const topic = await getTopic(id, true)
if (!topic) return Response.json({ success: false, error: 'topicNotFound' }, { status: 404 })
switch (action) {
case 'delete':
await setTopicFlag(id, 'deleted', true)
break
case 'undelete':
await setTopicFlag(id, 'deleted', false)
break
case 'lock':
await setTopicFlag(topicId, 'locked', true)
await setTopicFlag(id, 'locked', true)
break
case 'unlock':
await setTopicFlag(topicId, 'locked', false)
await setTopicFlag(id, 'locked', false)
break
case 'sticky':
await setTopicFlag(topicId, 'sticky', true)
break
case 'unsticky':
await setTopicFlag(topicId, 'sticky', false)
break
case 'delete':
await setTopicFlag(topicId, 'deleted', true)
return Response.json({ success: true, forumId: topic.forum_id })
case 'restore':
await setTopicFlag(topicId, 'deleted', false)
break
case 'move': {
const newForumId = Number(b.forumId)
if (!newForumId || newForumId === topic.forum_id) {
return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
}
if (!(await getForum(newForumId))) {
return Response.json({ success: false, error: 'invalidForum' }, { status: 400 })
}
await moveTopic(topicId, newForumId)
return Response.json({ success: true })
}
default:
return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
}
+11 -44
View File
@@ -1,25 +1,10 @@
import { getSession } from '@/lib/session'
import { getPost, updatePost, setPostDeleted } from '@/lib/forum-write'
import { getPost, updatePost } from '@/lib/forum-write'
import { getTopic } from '@/lib/forum'
import { forumIsModerator, canEditPost } from '@/lib/forum-perm'
import { plainLength } from '@/lib/forum-sanitize'
const MIN_TEXT_LEN = 5
/** Restaurar un post borrado. Solo moderadores. */
export async function PUT(request: Request) {
const session = await getSession()
if (!session.accountId) return Response.json({ success: false, error: 'notAuthenticated' }, { status: 401 })
if (!(await forumIsModerator(session))) return Response.json({ success: false, error: 'forbidden' }, { status: 403 })
let b: Record<string, string> = {}
try { b = await request.json() } catch { return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 }) }
const postId = Number(b.postId)
if (!postId) return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
await setPostDeleted(postId, false)
return Response.json({ success: true })
}
const MIN_TEXT_LEN = 3
/** Editar el texto de un post propio (o cualquiera si es moderador). */
export async function PATCH(request: Request) {
@@ -27,44 +12,26 @@ export async function PATCH(request: Request) {
if (!session.accountId) return Response.json({ success: false, error: 'notAuthenticated' }, { status: 401 })
let b: Record<string, string> = {}
try { b = await request.json() } catch { return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 }) }
try {
b = await request.json()
} catch {
return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
}
const postId = Number(b.postId)
const text = String(b.text ?? '').trim()
const text = String(b.text ?? '')
if (!postId) return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
const post = await getPost(postId)
if (!post) return Response.json({ success: false, error: 'postNotFound' }, { status: 404 })
const isMod = await forumIsModerator(session)
if (!canEditPost(session, isMod, post.poster_id)) return Response.json({ success: false, error: 'forbidden' }, { status: 403 })
if (!canEditPost(session, isMod, post.poster))
return Response.json({ success: false, error: 'forbidden' }, { status: 403 })
const topic = await getTopic(post.topic_id)
const topic = await getTopic(post.topic)
if (topic?.locked && !isMod) return Response.json({ success: false, error: 'topicLocked' })
if (plainLength(text) < MIN_TEXT_LEN) return Response.json({ success: false, error: 'tooShort' })
await updatePost(postId, text)
return Response.json({ success: true })
}
/** Borrar (lógico) un post propio (o cualquiera si es moderador). */
export async function DELETE(request: Request) {
const session = await getSession()
if (!session.accountId) return Response.json({ success: false, error: 'notAuthenticated' }, { status: 401 })
let b: Record<string, string> = {}
try { b = await request.json() } catch { return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 }) }
const postId = Number(b.postId)
if (!postId) return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
const post = await getPost(postId)
if (!post) return Response.json({ success: false, error: 'postNotFound' }, { status: 404 })
const isMod = await forumIsModerator(session)
if (!canEditPost(session, isMod, post.poster_id)) return Response.json({ success: false, error: 'forbidden' }, { status: 403 })
const topic = await getTopic(post.topic_id)
if (topic?.locked && !isMod) return Response.json({ success: false, error: 'topicLocked' })
await setPostDeleted(postId, true)
return Response.json({ success: true })
}
+11 -5
View File
@@ -1,15 +1,21 @@
import { getSession } from '@/lib/session'
import { createPost, topicIsReplyable } from '@/lib/forum-write'
import { plainLength } from '@/lib/forum-sanitize'
export async function POST(request: Request) {
const session = await getSession()
if (!session.accountId || !session.username) return Response.json({ success: false, error: 'notAuthenticated' }, { status: 401 })
if (!session.accountId || !session.username)
return Response.json({ success: false, error: 'notAuthenticated' }, { status: 401 })
let b: Record<string, string> = {}
try { b = await request.json() } catch { return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 }) }
try {
b = await request.json()
} catch {
return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
}
const topicId = Number(b.topicId)
const text = String(b.text ?? '').trim()
if (!topicId || !text) return Response.json({ success: false, error: 'emptyError' })
const text = String(b.text ?? '')
if (!topicId || plainLength(text) < 3) return Response.json({ success: false, error: 'emptyError' })
if (!(await topicIsReplyable(topicId))) return Response.json({ success: false, error: 'topicLocked' })
await createPost(topicId, session.username, session.accountId, text)
await createPost(topicId, session.accountId, text)
return Response.json({ success: true })
}
+16 -8
View File
@@ -1,16 +1,24 @@
import { getSession } from '@/lib/session'
import { createTopic, forumIsPostable } from '@/lib/forum-write'
import { createTopic } from '@/lib/forum-write'
import { forumExists } from '@/lib/forum'
import { plainLength } from '@/lib/forum-sanitize'
export async function POST(request: Request) {
const session = await getSession()
if (!session.accountId || !session.username) return Response.json({ success: false, error: 'notAuthenticated' }, { status: 401 })
if (!session.accountId || !session.username)
return Response.json({ success: false, error: 'notAuthenticated' }, { status: 401 })
let b: Record<string, string> = {}
try { b = await request.json() } catch { return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 }) }
try {
b = await request.json()
} catch {
return Response.json({ success: false, error: 'invalidRequest' }, { status: 400 })
}
const forumId = Number(b.forumId)
const name = String(b.name ?? '').trim()
const text = String(b.text ?? '').trim()
if (!forumId || !name || !text) return Response.json({ success: false, error: 'emptyError' })
if (!(await forumIsPostable(forumId))) return Response.json({ success: false, error: 'invalidForum' })
const topicId = await createTopic(forumId, name, session.username, session.accountId, text)
const title = String(b.title ?? '').trim()
const text = String(b.text ?? '')
if (!forumId || title.length < 3) return Response.json({ success: false, error: 'errTitle' })
if (plainLength(text) < 3) return Response.json({ success: false, error: 'emptyError' })
if (!(await forumExists(forumId))) return Response.json({ success: false, error: 'invalidForum' })
const topicId = await createTopic(forumId, title, session.accountId, text)
return Response.json({ success: true, topicId })
}
+242
View File
@@ -0,0 +1,242 @@
/*
* Estilos del foro (adaptado del forum.css original de FusionCMS).
* Cambios respecto al original:
* - rutas de imagen ../images/ -> /forum/ (assets en public/forum, ver copia)
* - el dorado del foro se alinea al acento del sitio (#d79602)
* - se aportan .nice_button, .main-wide y .pagination (no están en theme.css)
* theme.css se importa DESPUÉS y podría pisar reglas: por eso el foro cuelga de
* contenedores propios (.forum-container, .forum-padding, .topic_post…).
*/
:root {
--forum-gold: #d79602;
--forum-gold-soft: #c9a33c;
}
/* ===================== index ===================== */
.forum-container { margin: 0 40px; }
.category-title {
display: block;
color: #8a8272;
font-size: 15px;
font-weight: bold;
text-shadow: 0 0 8px #000, 0 1px 1px #000;
text-transform: uppercase;
text-align: left;
}
.forum-row {
width: 100%;
min-height: 75px;
display: flex;
align-items: center;
flex-wrap: wrap;
text-align: left;
border-radius: 3px;
overflow: hidden;
background: rgba(0, 0, 0, .18);
box-shadow: 0 0 11px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .03);
transition: all 200ms;
}
.forum-row:hover { box-shadow: 0 0 11px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .05); }
.forum-row .icon img { margin: 6px 0 0 6px; }
.forum-row .forum_title_desc { text-align: left; flex: 1 1 220px; }
.forum-row .forum_title_desc a { display: block; }
.forum-row .forum_title_desc a h1 {
font-size: 14px; color: var(--forum-gold); font-weight: bold; margin: 8px 0 0 20px; transition: all 200ms;
}
.forum-row .forum_title_desc a:hover h1 { color: #f0b53a; }
.forum-row .forum_title_desc a h2 { font-size: 12px; color: #6d6a5e; font-weight: bold; margin: 4px 0 8px 20px; }
.forum-row .post, .forum-row .topics { min-width: 78px; text-align: center; }
.forum-row .post p, .forum-row .topics p { font-size: 15px; color: #8a8578; font-weight: bold; margin: 24px 0; }
.forum-row .lastpost { flex: 1 1 200px; padding-left: 12px; }
.forum-row .lastpost p.topic_title a { font-size: 12px; color: #8d8370; font-weight: bold; }
.forum-row .lastpost p.topic_title a:hover { color: var(--forum-gold); }
.forum-row .lastpost p.by { margin: 0 0 0 15px; }
.forum-row .lastpost p.by a { font-size: 12px; font-weight: bold; color: var(--forum-gold-soft); }
.forum-row .lastpost p.postdate { font-size: 11px; color: #6d6a5e; margin: 0 0 0 15px; }
/* class tiles (type 1) & flag tiles (type 2) */
.class-row {
display: flex;
align-items: center;
width: 100%;
min-height: 53px;
overflow: hidden;
background: rgba(0, 0, 0, .18);
box-shadow: 0 0 11px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .03);
border-radius: 4px;
transition: all 200ms;
}
.class-row:hover { box-shadow: 0 0 11px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .05); }
.class-row .icon { width: 36px; height: 36px; margin: 8px; flex: 0 0 auto; }
.class-row .icon img.image_icon { width: 36px; height: 36px; border-radius: 3px; box-shadow: 0 0 6px rgba(0, 0, 0, .4); }
.class-row .icon div.image_icon {
width: 36px; height: 36px;
background-image: url(/forum/forum_icons/icons.jpg);
background-repeat: no-repeat;
border-radius: 3px;
box-shadow: 0 0 6px rgba(0, 0, 0, .4);
}
.deathknight .icon div.image_icon { background-position: 0 0; }
.druid .icon div.image_icon { background-position: -36px 0; }
.hunter .icon div.image_icon { background-position: -72px 0; }
.mage .icon div.image_icon { background-position: -108px 0; }
.paladin .icon div.image_icon { background-position: -144px 0; }
.priest .icon div.image_icon { background-position: -180px 0; }
.rogue .icon div.image_icon { background-position: -216px 0; }
.shaman .icon div.image_icon { background-position: -252px 0; }
.warlock .icon div.image_icon { background-position: -288px 0; }
.warrior .icon div.image_icon { background-position: -324px 0; }
.monk .icon div.image_icon { background-position: -360px 0; }
.demonhunter .icon div.image_icon { background-position: -396px 0; }
.evoker .icon div.image_icon { background-position: -432px 0; }
.class-row .info { margin: 0 0 0 4px; text-align: left; }
.class-row .info a { display: block; }
.class-row .info a h1 { font-size: 13px; color: var(--forum-gold); }
.class-row .info a h2 { font-size: 11px; color: #6d6a5e; }
.forum-path { margin-bottom: 10px; display: block; color: var(--forum-gold); font-weight: bold; }
.forum-path a { color: var(--forum-gold); opacity: .7; }
.forum-path a:hover { opacity: 1; }
.forum-path .sep { opacity: .4; margin: 0 6px; }
/* ===================== subforum ===================== */
.main-wide { max-width: 1100px; margin: 0 auto; padding: 0 15px; }
.forum-padding { margin: 0 30px; }
.forum_header, .topic_header {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin: 20px 0;
padding-bottom: 12px;
box-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}
.forum_title h1 { font-size: 24px; color: var(--forum-gold); }
.forum_title h3 { font-weight: bold; font-size: 13px; color: #6d6a5e; }
.forum_header h4, .topic_header h4 { font-size: 20px; color: #6d6a5e; font-weight: normal; }
.forum_header h4 b, .topic_header h4 b { color: var(--forum-gold-soft); }
.actions_c { display: flex; justify-content: space-between; align-items: center; margin: 0 0 24px; flex-wrap: wrap; gap: 10px; }
ul.pagination { display: flex; list-style: none; padding: 0; margin: 0; gap: 3px; flex-wrap: wrap; }
ul.pagination li a, ul.pagination li p {
display: block; min-width: 24px; height: 24px; line-height: 24px; padding: 0 6px;
background: rgba(241, 221, 196, .07); border-radius: 3px; text-align: center; color: #8a8578;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .02), 0 1px 1px rgba(0, 0, 0, .4);
}
ul.pagination li.active p { color: var(--forum-gold); font-weight: bold; }
ul.pagination li a:hover { color: var(--forum-gold); }
ul.topic_row {
display: flex; flex-wrap: nowrap; align-items: center; width: 100%; list-style: none; margin: 0 0 6px; padding: 0;
background: rgba(0, 0, 0, .18);
box-shadow: 0 0 11px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .03);
border-radius: 3px;
}
ul.topic_row li { text-shadow: 0 0 6px rgba(0, 0, 0, .5), 0 1px 1px rgba(0, 0, 0, .6); }
ul.topic_row .icon { width: 60px; flex: 0 0 auto; }
ul.topic_row .icon img { margin: 8px 0 0 4px; }
ul.topic_row li.topic_title_by_date { flex: 1 1 auto; text-align: left; }
ul.topic_row li.topic_title_by_date h1 { margin: 11px 0 0 14px; }
ul.topic_row li.topic_title_by_date h1 a { font-size: 13px; font-weight: bold; color: var(--forum-gold); }
ul.topic_row li.topic_title_by_date h1 a:hover { color: #f0b53a; }
ul.topic_row li.topic_title_by_date p { margin: 3px 0 8px 14px; font-weight: bold; font-size: 11px; color: #6d6a5e; }
ul.topic_row li.topic_title_by_date p a.username { color: var(--forum-gold-soft); }
ul.topic_row .lastpost { flex: 0 0 220px; padding-left: 14px; color: #6d6a5e; text-align: left; }
ul.topic_row .lastpost h4 { margin: 13px 0 0 0; font-size: 11px; }
ul.topic_row .lastpost h4 a { color: var(--forum-gold-soft); }
ul.topic_row .lastpost h5 { margin: 2px 0 8px; font-size: 11px; color: #6d6a5e; }
.forum-empty { text-align: center; color: #6d6a5e; padding: 30px 0; }
/* ===================== posts ===================== */
.topic_title h1 { font-size: 22px; color: var(--forum-gold); margin: 0 0 5px; font-weight: bold; }
.topic_title h3 { font-weight: bold; font-size: 13px; color: #6d6a5e; }
.topic_post {
display: flex; flex-wrap: wrap; width: 100%;
background: rgba(0, 0, 0, .18);
box-shadow: 0 0 11px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .03);
border-radius: 3px; margin: 0 0 30px;
}
.topic_post.isStaff {
box-shadow: inset 0 0 1px rgba(96, 76, 65, .3), 0 0 0 1px #251d19, 0 2px 2px rgba(0, 0, 0, .3), inset 0 0 46px rgba(255, 68, 0, .12);
}
.topic_post .left_side {
flex: 0 0 200px; padding: 10px; background: rgba(0, 0, 0, .25);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03);
}
.topic_post .right_side { flex: 1 1 320px; display: flex; flex-direction: column; }
.username_container { display: block; margin: 6px 0 0; text-align: center; }
.username_container a.username { font-size: 14px; color: var(--forum-gold-soft); font-weight: bold; }
.topic_post .left_side .user_avatar {
width: 86px; height: 86px; border-radius: 3px; margin: 16px auto; overflow: hidden;
background: rgba(69, 67, 62, .5);
box-shadow: inset 0 0 1px 1px rgba(255, 255, 255, .05), inset 0 0 28px rgba(0, 0, 0, .8), 0 0 16px rgba(0, 0, 0, .6);
}
.topic_post .left_side .user_avatar.isStaff { border: 1px solid #813c26; box-shadow: 0 0 21px rgba(240, 106, 59, .45); }
.topic_post .left_side .user_avatar span { display: block; width: 100%; height: 100%; }
.topic_post .left_side .user_info { text-align: center; }
h3.post_field {
border: 1px solid #212322; border-radius: 5px; margin: 8px 4px; display: flex; align-items: center; gap: .5rem; padding: 8px;
font-size: 12px; font-weight: bold; color: #8a8578;
}
h3.post_field dt { min-width: auto; }
h3.post_field dd { margin: 0; }
.badge_staff { color: #f06a3b; }
.topic_post .right_side .post_container {
padding: 14px; font-size: 13px; color: #b5b1a3; min-height: 120px;
text-shadow: 0 1px 1px rgba(0, 0, 0, .6);
}
.topic_post .right_side .post_container img { display: block; max-width: 100%; height: auto; }
.topic_post .right_side .post_container a { color: var(--forum-gold-soft); text-decoration: underline; }
.post_deleted { opacity: .5; }
ul.post_controls { display: flex; justify-content: flex-end; align-items: center; gap: 8px; list-style: none; padding: 15px; margin: auto 0 0; }
ul.post_controls li { height: 20px; }
ul.post_controls li a {
display: block; border-radius: 2px; padding: 4px 8px; background: rgba(255, 255, 255, .04); font-weight: bold; color: #8a8578;
box-shadow: 0 1px 1px rgba(0, 0, 0, .13), inset 0 1px 1px rgba(255, 255, 255, .04);
}
ul.post_controls li a:hover { background: rgba(255, 255, 255, .08); color: var(--forum-gold); }
ul.post_controls .post_date { color: #6d6a5e; font-weight: bold; font-size: 11px; margin-right: auto; }
/* quick reply / editor */
.quick_reply { padding: 0 20px 20px; background: rgba(0, 0, 0, .18); border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03); }
.quick_reply h2 { font-size: 14px; color: #8a8578; padding: 18px 0; text-transform: uppercase; text-align: left; }
.forum-form-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.forum-form-actions .right-0 { margin-left: auto; }
.forum-input {
width: 100%; padding: 12px; margin: 12px 0; border: none; border-radius: 3px; color: #d4cdbb; font-size: 14px;
background: rgba(0, 0, 0, .25); box-shadow: inset 1px 1px 2px rgba(0, 0, 0, .25), inset 0 0 10px rgba(0, 0, 0, .1);
}
.forum-input::placeholder { color: #6d6a5e; }
/* nice_button (no está en theme.css) */
.nice_button {
display: inline-block; padding: 9px 18px; border-radius: 5px; cursor: pointer; font-weight: bold; text-transform: uppercase;
color: #1c1305; border: 1px solid #b08f1d; background: linear-gradient(#e3ab2d, #b08f1d); transition: all 150ms;
}
.nice_button:hover { background: linear-gradient(#f0b53a, #c9a836); }
.nice_button:disabled { opacity: .5; cursor: default; }
/* ===================== responsive ===================== */
@media (max-width: 991px) {
.forum-container { margin: 0; }
.forum-padding { margin: 0; }
}
@media (max-width: 767px) {
.forum-row .post, .forum-row .topics { display: none; }
ul.topic_row .lastpost { display: none; }
.topic_post .left_side { flex-basis: 100%; }
.topic_post .left_side .user_avatar { width: 56px; height: 56px; }
}