118 lines
5.3 KiB
PHP
118 lines
5.3 KiB
PHP
<?php
|
|
require_once __DIR__ . '/includes/app.php';
|
|
ensure_tables();
|
|
|
|
$pageTitle = 'Home';
|
|
$active = 'home';
|
|
$pdo = db();
|
|
$builds = $pdo->query("SELECT id, title, game, class_name, patch, summary, author, created_at FROM builds ORDER BY created_at DESC LIMIT 3")->fetchAll();
|
|
$threads = $pdo->query("SELECT id, title, game, tag, author, created_at FROM forum_threads ORDER BY created_at DESC LIMIT 3")->fetchAll();
|
|
|
|
include __DIR__ . '/includes/header.php';
|
|
?>
|
|
|
|
<?php if (!empty($_GET['registered'])): ?>
|
|
<div class="alert alert-success" role="alert">Account created. You are now logged in.</div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($_GET['logged_out'])): ?>
|
|
<div class="alert alert-success" role="alert">You have been logged out.</div>
|
|
<?php endif; ?>
|
|
|
|
<section class="hero mb-4">
|
|
<div class="row align-items-center g-4">
|
|
<div class="col-lg-7">
|
|
<span class="tag mb-3 d-inline-flex">Patch-ready community hub</span>
|
|
<h1 class="display-6 fw-semibold">Track the best builds and keep the meta in focus.</h1>
|
|
<p class="muted">Publish build guides, track patch notes, and keep tactical discussions organized. This MVP delivers searchable builds, build detail pages with comments, and live forum threads.</p>
|
|
<div class="d-flex flex-wrap gap-2 mt-4">
|
|
<a class="btn btn-primary" href="builds.php">Browse builds</a>
|
|
<a class="btn btn-outline-light" href="create_build.php">Publish a build</a>
|
|
<a class="btn btn-outline-light" href="forums.php">Visit forums</a>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-5">
|
|
<div class="app-card">
|
|
<h2 class="h5 mb-3">Live 1111pulse</h2>
|
|
<ul class="list-unstyled mb-0">
|
|
<li class="d-flex justify-content-between mb-2"><span class="muted">Active builds</span><span class="fw-semibold"><?= h((string)$pdo->query("SELECT COUNT(*) FROM builds")->fetchColumn()) ?></span></li>
|
|
<li class="d-flex justify-content-between mb-2"><span class="muted">Forum threads</span><span class="fw-semibold"><?= h((string)$pdo->query("SELECT COUNT(*) FROM forum_threads")->fetchColumn()) ?></span></li>
|
|
<li class="d-flex justify-content-between"><span class="muted">Latest update</span><span class="fw-semibold"><?= h(date('M j, Y')) ?></span></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="mb-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<h2 class="section-title">Featured builds</h2>
|
|
<a class="muted" href="builds.php">View all →</a>
|
|
</div>
|
|
<div class="row g-3">
|
|
<?php if (!$builds): ?>
|
|
<div class="col-12">
|
|
<div class="app-card">
|
|
<h3 class="h5">No builds yet</h3>
|
|
<p class="muted">Start by publishing the first build so the community can discuss skills, gear, and patch impact.</p>
|
|
<a class="btn btn-primary" href="create_build.php">Publish first build</a>
|
|
</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($builds as $build): ?>
|
|
<div class="col-md-4">
|
|
<div class="app-card h-100">
|
|
<div class="d-flex justify-content-between align-items-start mb-2">
|
|
<span class="badge badge-soft"><?= h($build['game']) ?></span>
|
|
<?php if (!empty($build['patch'])): ?>
|
|
<span class="badge badge-soft">Patch <?= h($build['patch']) ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<h3 class="h5"><?= h($build['title']) ?></h3>
|
|
<p class="muted mb-3"><?= h($build['summary'] ?: 'Build summary coming soon.') ?></p>
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<span class="muted"><?= h($build['class_name']) ?> · <?= h($build['author']) ?></span>
|
|
<a class="btn btn-sm btn-outline-light" href="build.php?id=<?= h((string)$build['id']) ?>">Open</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|
|
|
|
<section>
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<h2 class="section-title">Latest forum threads</h2>
|
|
<a class="muted" href="forums.php">View all →</a>
|
|
</div>
|
|
<div class="row g-3">
|
|
<?php if (!$threads): ?>
|
|
<div class="col-12">
|
|
<div class="app-card">
|
|
<h3 class="h5">No threads yet</h3>
|
|
<p class="muted">Kick off the first discussion with patch feedback or class strategy.</p>
|
|
<a class="btn btn-outline-light" href="create_thread.php">Start thread</a>
|
|
</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($threads as $thread): ?>
|
|
<div class="col-md-4">
|
|
<div class="app-card h-100">
|
|
<div class="d-flex justify-content-between align-items-start mb-2">
|
|
<span class="badge badge-soft"><?= h($thread['game']) ?></span>
|
|
<?php if (!empty($thread['tag'])): ?>
|
|
<span class="badge badge-soft"><?= h($thread['tag']) ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<h3 class="h5"><?= h($thread['title']) ?></h3>
|
|
<p class="muted mb-3">Started by <?= h($thread['author']) ?> · <?= h(format_date($thread['created_at'])) ?></p>
|
|
<a class="btn btn-sm btn-outline-light" href="thread.php?id=<?= h((string)$thread['id']) ?>">Open thread</a>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|
|
|
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|