fix: resolve broken lib/ require paths in admin and normalise modern-normalize to .min.css

This commit is contained in:
Pontoporeia
2026-02-24 23:19:18 +01:00
parent da53d56744
commit d30153871f
13 changed files with 21 additions and 21 deletions

View File

@@ -14,19 +14,19 @@ third-party dependencies. The tasks below are ordered from critical to nice-to-h
## Critical Bugs (broken at runtime)
- [ ] **Fix broken `lib/` require paths in all admin pages**
- [x] **Fix broken `lib/` require paths in all admin pages**
Admin pages (`add.php`, `edit.php`, `import.php`, `thanks.php`, `login.php`,
`logout.php`, `actions/formulaire.php`, `actions/publish.php`) all require
`../../lib/AdminAuth.php` and `../../lib/Database.php`, but the `lib/` directory
**does not exist**. The actual files live in `src/`. This means the entire admin
panel is broken. Fix: change all `lib/` references to `src/`.
- [ ] **Fix missing `modern-normalize.css` (no `.min` variant)**
- [x] **Fix missing `modern-normalize.css` (no `.min` variant)**
`templates/header.php`, `templates/head.php`, and `public/search.php` reference
`assets/modern-normalize.css` (without `.min`), but only `modern-normalize.min.css`
exists. Either rename the file or update the references to be consistent.
- [ ] **Fix `admin/index.php` inconsistency**
- [x] **Fix `admin/index.php` inconsistency**
`admin/index.php` uses `src/AdminAuth.php` (correct) but then
`../../lib/Database.php` (broken). It should load from `src/` consistently.

View File

@@ -1,7 +1,7 @@
<?php // formulaire.php
// Bootstrap application
require_once __DIR__ . "/../../config/bootstrap.php";
require_once __DIR__ . '/../../lib/AdminAuth.php';
require_once __DIR__ . '/../../src/AdminAuth.php';
// Configure error reporting
ini_set('display_errors', 0);
@@ -21,7 +21,7 @@ if (!isset($_POST['csrf_token']) || !isset($_SESSION['csrf_token']) ||
// Log the content of the $_FILES array
error_log("FILES array: " . print_r($_FILES, true));
require_once __DIR__ . '/../../lib/Database.php';
require_once __DIR__ . '/../../src/Database.php';
// Helper function to sanitize string input
function sanitize_string($input) {

View File

@@ -1,7 +1,7 @@
<?php
// Bootstrap application
require_once __DIR__ . "/../../config/bootstrap.php";
require_once __DIR__ . '/../../lib/AdminAuth.php';
require_once __DIR__ . '/../../src/AdminAuth.php';
/**
* Handle publish/unpublish actions for theses
@@ -9,7 +9,7 @@ require_once __DIR__ . '/../../lib/AdminAuth.php';
// PHP-level auth guard (defence-in-depth behind nginx Basic Auth)
AdminAuth::requireLogin();
require_once __DIR__ . '/../../lib/Database.php';
require_once __DIR__ . '/../../src/Database.php';
// Verify CSRF token
if (!isset($_POST['csrf_token']) || !isset($_SESSION['csrf_token']) || !hash_equals($_SESSION['csrf_token'], $_POST['csrf_token'])) {

View File

@@ -1,7 +1,7 @@
<?php
// Bootstrap application
require_once __DIR__ . "/../../config/bootstrap.php";
require_once __DIR__ . '/../../lib/AdminAuth.php';
require_once __DIR__ . '/../../src/AdminAuth.php';
// PHP-level auth guard (defence-in-depth behind nginx Basic Auth)
AdminAuth::requireLogin();
@@ -13,7 +13,7 @@ if (empty($_SESSION["csrf_token"])) {
$pageTitle = "Ajout de TFE";
// Load database helper
require_once __DIR__ . '/../../lib/Database.php';
require_once __DIR__ . '/../../src/Database.php';
try {
$db = new Database();

View File

@@ -1,7 +1,7 @@
<?php
// Bootstrap application
require_once __DIR__ . "/../../config/bootstrap.php";
require_once __DIR__ . '/../../lib/AdminAuth.php';
require_once __DIR__ . '/../../src/AdminAuth.php';
// PHP-level auth guard (defence-in-depth behind nginx Basic Auth)
AdminAuth::requireLogin();
@@ -11,7 +11,7 @@ if (empty($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
}
require_once __DIR__ . '/../../lib/Database.php';
require_once __DIR__ . '/../../src/Database.php';
$thesisId = isset($_GET['id']) ? intval($_GET['id']) : 0;
$error = null;

View File

@@ -1,7 +1,7 @@
<?php
// Bootstrap application
require_once __DIR__ . "/../../config/bootstrap.php";
require_once __DIR__ . '/../../lib/AdminAuth.php';
require_once __DIR__ . '/../../src/AdminAuth.php';
// CSV Import page for Post-ERG thesis database
// This page allows importing thesis data from CSV files
@@ -14,7 +14,7 @@ if (empty($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
}
require_once __DIR__ . '/../../lib/Database.php';
require_once __DIR__ . '/../../src/Database.php';
$pageTitle = "Import";

View File

@@ -13,7 +13,7 @@ if (empty($_SESSION['csrf_token'])) {
$pageTitle = "Liste des TFE";
require_once __DIR__ . '/../../lib/Database.php';
require_once __DIR__ . '/../../src/Database.php';
try {
$db = new Database();

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__ . '/../../config/bootstrap.php';
require_once __DIR__ . '/../../lib/AdminAuth.php';
require_once __DIR__ . '/../../src/AdminAuth.php';
// If no password is configured, nothing to log into — go straight to admin.
if (!defined('ADMIN_PASSWORD_HASH')) {

View File

@@ -1,6 +1,6 @@
<?php
require_once __DIR__ . '/../../config/bootstrap.php';
require_once __DIR__ . '/../../lib/AdminAuth.php';
require_once __DIR__ . '/../../src/AdminAuth.php';
AdminAuth::logout();

View File

@@ -1,7 +1,7 @@
<?php
// Bootstrap application
require_once __DIR__ . "/../../config/bootstrap.php";
require_once __DIR__ . '/../../lib/AdminAuth.php';
require_once __DIR__ . '/../../src/AdminAuth.php';
// PHP-level auth guard (defence-in-depth behind nginx Basic Auth)
AdminAuth::requireLogin();
@@ -11,7 +11,7 @@ ini_set('display_errors', 0);
ini_set('log_errors', 1);
ini_set('error_log', 'error.log');
require __DIR__ . '/../../lib/Database.php';
require_once __DIR__ . '/../../src/Database.php';
// Security: Validate thesis ID parameter
$thesisId = null;

View File

@@ -116,7 +116,7 @@ try {
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Recherche - Posterg</title>
<link rel="stylesheet" href="assets/modern-normalize.css">
<link rel="stylesheet" href="assets/modern-normalize.min.css">
<link rel="stylesheet" href="assets/common.css">
<link rel="stylesheet" href="assets/search.css">
</head>

View File

@@ -7,7 +7,7 @@
<meta name="author" content="">
<meta name="description" content="">
<title><?= isset($pageTitle) ? htmlspecialchars($pageTitle) . ' - Posterg' : 'Posterg' ?></title>
<link rel="stylesheet" href="assets/modern-normalize.css">
<link rel="stylesheet" href="assets/modern-normalize.min.css">
<link rel="stylesheet" href="assets/common.css">
<?php if (isset($additionalCSS)): ?>
<?php foreach ((array)$additionalCSS as $css): ?>

View File

@@ -8,7 +8,7 @@
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Posterg</title>
<link rel="stylesheet" href="assets/modern-normalize.css">
<link rel="stylesheet" href="assets/modern-normalize.min.css">
<link rel="stylesheet" href="assets/common.css">
<link rel="stylesheet" href="assets/main.css">
<?php if (php_sapi_name() === 'cli-server'): ?>