97 lines
4.4 KiB
PHP
97 lines
4.4 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
$delulus = [];
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->query('SELECT username, title, body, created_at FROM delulus ORDER BY created_at DESC');
|
|
$delulus = $stmt->fetchAll();
|
|
} catch (PDOException $e) {
|
|
// For now, we just show an error. In a real app, you'd log this.
|
|
error_log($e->getMessage());
|
|
}
|
|
|
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'A playful social space where imagination meets validation.';
|
|
$projectTitle = 'Delulu is the New Sululu';
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title><?= htmlspecialchars($projectTitle) ?></title>
|
|
|
|
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="og:title" content="<?= htmlspecialchars($projectTitle) ?>" />
|
|
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="twitter:card" content="summary_large_image" />
|
|
<meta property="twitter:title" content="<?= htmlspecialchars($projectTitle) ?>" />
|
|
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
|
|
<?php if (!empty($_SERVER['PROJECT_IMAGE_URL'])): ?>
|
|
<meta property="og:image" content="<?= htmlspecialchars($_SERVER['PROJECT_IMAGE_URL']) ?>" />
|
|
<meta property="twitter:image" content="<?= htmlspecialchars($_SERVER['PROJECT_IMAGE_URL']) ?>" />
|
|
<?php endif; ?>
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body>
|
|
|
|
<nav class="navbar navbar-expand-lg navbar-light bg-white">
|
|
<div class="container">
|
|
<a class="navbar-brand" href="#" style="color: #A076F9; font-weight: bold;"><?= htmlspecialchars($projectTitle) ?></a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav ms-auto">
|
|
<li class="nav-item">
|
|
<a class="btn btn-primary" href="#">Sign in with Google</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<main class="container my-5">
|
|
<div class="text-center gradient-bg">
|
|
<h1 class="display-4">Welcome to the Delulu Space</h1>
|
|
<p class="lead">Share your dreams, manifest your future, and find your sululu.</p>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<?php if (empty($delulus)): ?>
|
|
<div class="col">
|
|
<div class="alert alert-info">No delulus posted yet. Be the first!</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($delulus as $delulu): ?>
|
|
<div class="col-md-6 col-lg-4 mb-4">
|
|
<div class="card delulu-card h-100">
|
|
<div class="card-body">
|
|
<h5 class="card-title"><?= htmlspecialchars($delulu['title']) ?></h5>
|
|
<h6 class="card-subtitle mb-2 text-muted">@<?= htmlspecialchars($delulu['username']) ?></h6>
|
|
<p class="card-text"><?= nl2br(htmlspecialchars(substr($delulu['body'], 0, 100))) . (strlen($delulu['body']) > 100 ? '...' : '') ?></p>
|
|
</div>
|
|
<div class="card-footer bg-transparent border-0 text-end">
|
|
<small class="text-muted"><?= date('M j, Y', strtotime($delulu['created_at'])) ?></small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</main>
|
|
|
|
<footer class="text-center py-4">
|
|
<p>© <?= date('Y') ?> <?= htmlspecialchars($projectTitle) ?>. All rights reserved.</p>
|
|
</footer>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|