Major refactor

- update the structure to have monolithic setup
- updated deployments
- added live-reloading for devops
This commit is contained in:
Théophile Gervreau-Mercier
2026-02-05 20:07:05 +01:00
parent f23fbb481b
commit d2b3c6ca67
75 changed files with 3359 additions and 3987 deletions

95
index.php Normal file
View File

@@ -0,0 +1,95 @@
<?php
ini_set("display_errors", 0);
ini_set("log_errors", 1);
ini_set("error_log", "error.log");
require_once __DIR__ . "/lib/Database.php";
$page = isset($_GET["page"]) ? intval($_GET["page"]) : 1;
$itemsPerPage = 10;
try {
$db = Database::getInstance();
$offset = ($page - 1) * $itemsPerPage;
$itemsToLoad = $db->getPublishedTheses($itemsPerPage, $offset);
$totalItems = $db->countPublishedTheses();
$totalPages = ceil($totalItems / $itemsPerPage);
} catch (Exception $e) {
error_log("Error loading theses: " . $e->getMessage());
$itemsToLoad = [];
$totalPages = 0;
}
include "inc/header.php";
?>
<main>
<section class="section">
<div class="container">
<div class="columns is-multiline">
<?php foreach ($itemsToLoad as $item): ?>
<div class="column is-one-fifth">
<a href="memoire.php?id=<?= $item["id"] ?>" class="card-link">
<div class="card">
<?php
// Get cover image from thesis_files if available
$coverImage = null;
if (!empty($item["id"])) {
$files = $db->getThesisFiles($item["id"]);
foreach ($files as $file) {
$ext = strtolower(
pathinfo($file["file_path"], PATHINFO_EXTENSION),
);
if (
in_array($ext, ["jpg", "jpeg", "png", "gif"]) &&
$file["file_type"] === "main"
) {
$coverImage = $file["file_path"];
break;
}
}
}
?>
<?php if ($coverImage): ?>
<div class="card-image">
<figure class="image ">
<img src="<?= htmlspecialchars(
$coverImage,
) ?>" alt="Image preview">
</figure>
</div>
<?php endif; ?>
<div class="card-content">
<h4 class="title is-4">
<?= htmlspecialchars($item["title"]) ?>
</h4>
<h2 class="subtitle">
<?= htmlspecialchars($item["authors"] ?? "Auteur inconnu") ?>
</h2>
<h3 class="tag title is-6 is-link is-light">
<?= htmlspecialchars($item["year"]) ?>
</h3>
<p class="block content">
<?php
$excerpt_length = 150;
$synopsis = $item["synopsis"] ?? "";
$description_excerpt =
strlen($synopsis) > $excerpt_length
? substr($synopsis, 0, $excerpt_length) . "..."
: $synopsis;
?>
<?= htmlspecialchars($description_excerpt) ?>
</p>
</div>
</div>
</a>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
</main>
<?php include "inc/footer.php";
?>