caluta7/index.php

95 lines
No EOL
2.3 KiB
PHP

<?php
require 'vendor/autoload.php';
use Yusurko\Caluta7\PageLoader;
$link = $_GET['link'] ?? 'index';
$pl = new PageLoader();
$pl->load($link);
if ($pl->getError() !== false) {
$error = $pl->getError();
http_response_code($error['status']);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><?= htmlspecialchars($pl->getTitle()); ?> | Caluta, Inc.</title>
<style>
:root {
--fg-main: #e8eef2;
--bg-main: #121821;
--bg-alt: #313840;
}
body {
background-color: var(--bg-main);
color: var(--fg-main);
font-family: 'Inter', sans-serif;
margin: 0;
}
#site__header {
background-color: var(--bg-alt);
padding: 13px;
}
#site__header h1 {
margin: 0;
font-size: 1.5em;
}
main {
padding: 13px;
margin: auto;
max-width: 1000px;
}
article header :is(h1, h2, .meta) {
text-align: center;
}
img.logo {
height: 1em;
vertical-align: middle;
}
#site__footer {
text-align: center;
font-size: 85%;
}
</style>
</head>
<body>
<header id="site__header">
<h1><img src="/caluta_flag.png" alt="" class="logo" /> Caluta, Inc.</h1>
</header>
<main>
<article>
<header>
<?php if($pl->getError() === false): ?>
<h1><?= htmlspecialchars($pl->getTitle()); ?></h1>
<?php if($pl->getUpdatedAt() !== false): ?>
<p class="meta">Last update: <?= htmlspecialchars(date('F j, Y', $pl->getUpdatedAt())); ?></p>
<?php endif; ?>
<?php else: ?>
<h1><?= "{$pl->getError()['status']}" ?></h1>
<h2><?= "{$pl->getError()['message']}" ?></h2>
<?php endif; ?>
</header>
<?php if($pl->getError() === false): ?>
<?= $pl->getHtml(); ?>
<?php endif; ?>
</article>
</main>
<footer id="site__footer">
<p>&copy; 2026 yusurko</p>
<p>Engine is licensed under GNU Affero General Public License (<a href="https://nekode.yusur.moe/yusur/caluta7">source code</a>)</p>
<p>Content is licensed under CC BY-NC-SA 4.0.</p>
<p>Caluta, Inc. does not store your information nor use cookies.</p>
</footer>
</body>
</html>