mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
fix: resolve broken lib/ require paths in admin and normalise modern-normalize to .min.css
This commit is contained in:
6
TODO.md
6
TODO.md
@@ -14,19 +14,19 @@ third-party dependencies. The tasks below are ordered from critical to nice-to-h
|
|||||||
|
|
||||||
## Critical Bugs (broken at runtime)
|
## 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`,
|
Admin pages (`add.php`, `edit.php`, `import.php`, `thanks.php`, `login.php`,
|
||||||
`logout.php`, `actions/formulaire.php`, `actions/publish.php`) all require
|
`logout.php`, `actions/formulaire.php`, `actions/publish.php`) all require
|
||||||
`../../lib/AdminAuth.php` and `../../lib/Database.php`, but the `lib/` directory
|
`../../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
|
**does not exist**. The actual files live in `src/`. This means the entire admin
|
||||||
panel is broken. Fix: change all `lib/` references to `src/`.
|
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
|
`templates/header.php`, `templates/head.php`, and `public/search.php` reference
|
||||||
`assets/modern-normalize.css` (without `.min`), but only `modern-normalize.min.css`
|
`assets/modern-normalize.css` (without `.min`), but only `modern-normalize.min.css`
|
||||||
exists. Either rename the file or update the references to be consistent.
|
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
|
`admin/index.php` uses `src/AdminAuth.php` (correct) but then
|
||||||
`../../lib/Database.php` (broken). It should load from `src/` consistently.
|
`../../lib/Database.php` (broken). It should load from `src/` consistently.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php // formulaire.php
|
<?php // formulaire.php
|
||||||
// Bootstrap application
|
// Bootstrap application
|
||||||
require_once __DIR__ . "/../../config/bootstrap.php";
|
require_once __DIR__ . "/../../config/bootstrap.php";
|
||||||
require_once __DIR__ . '/../../lib/AdminAuth.php';
|
require_once __DIR__ . '/../../src/AdminAuth.php';
|
||||||
|
|
||||||
// Configure error reporting
|
// Configure error reporting
|
||||||
ini_set('display_errors', 0);
|
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
|
// Log the content of the $_FILES array
|
||||||
error_log("FILES array: " . print_r($_FILES, true));
|
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
|
// Helper function to sanitize string input
|
||||||
function sanitize_string($input) {
|
function sanitize_string($input) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
// Bootstrap application
|
// Bootstrap application
|
||||||
require_once __DIR__ . "/../../config/bootstrap.php";
|
require_once __DIR__ . "/../../config/bootstrap.php";
|
||||||
require_once __DIR__ . '/../../lib/AdminAuth.php';
|
require_once __DIR__ . '/../../src/AdminAuth.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle publish/unpublish actions for theses
|
* 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)
|
// PHP-level auth guard (defence-in-depth behind nginx Basic Auth)
|
||||||
AdminAuth::requireLogin();
|
AdminAuth::requireLogin();
|
||||||
|
|
||||||
require_once __DIR__ . '/../../lib/Database.php';
|
require_once __DIR__ . '/../../src/Database.php';
|
||||||
|
|
||||||
// Verify CSRF token
|
// Verify CSRF token
|
||||||
if (!isset($_POST['csrf_token']) || !isset($_SESSION['csrf_token']) || !hash_equals($_SESSION['csrf_token'], $_POST['csrf_token'])) {
|
if (!isset($_POST['csrf_token']) || !isset($_SESSION['csrf_token']) || !hash_equals($_SESSION['csrf_token'], $_POST['csrf_token'])) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
// Bootstrap application
|
// Bootstrap application
|
||||||
require_once __DIR__ . "/../../config/bootstrap.php";
|
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)
|
// PHP-level auth guard (defence-in-depth behind nginx Basic Auth)
|
||||||
AdminAuth::requireLogin();
|
AdminAuth::requireLogin();
|
||||||
@@ -13,7 +13,7 @@ if (empty($_SESSION["csrf_token"])) {
|
|||||||
$pageTitle = "Ajout de TFE";
|
$pageTitle = "Ajout de TFE";
|
||||||
|
|
||||||
// Load database helper
|
// Load database helper
|
||||||
require_once __DIR__ . '/../../lib/Database.php';
|
require_once __DIR__ . '/../../src/Database.php';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$db = new Database();
|
$db = new Database();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
// Bootstrap application
|
// Bootstrap application
|
||||||
require_once __DIR__ . "/../../config/bootstrap.php";
|
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)
|
// PHP-level auth guard (defence-in-depth behind nginx Basic Auth)
|
||||||
AdminAuth::requireLogin();
|
AdminAuth::requireLogin();
|
||||||
@@ -11,7 +11,7 @@ if (empty($_SESSION['csrf_token'])) {
|
|||||||
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
$_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;
|
$thesisId = isset($_GET['id']) ? intval($_GET['id']) : 0;
|
||||||
$error = null;
|
$error = null;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
// Bootstrap application
|
// Bootstrap application
|
||||||
require_once __DIR__ . "/../../config/bootstrap.php";
|
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
|
// CSV Import page for Post-ERG thesis database
|
||||||
// This page allows importing thesis data from CSV files
|
// 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));
|
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once __DIR__ . '/../../lib/Database.php';
|
require_once __DIR__ . '/../../src/Database.php';
|
||||||
|
|
||||||
$pageTitle = "Import";
|
$pageTitle = "Import";
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ if (empty($_SESSION['csrf_token'])) {
|
|||||||
|
|
||||||
$pageTitle = "Liste des TFE";
|
$pageTitle = "Liste des TFE";
|
||||||
|
|
||||||
require_once __DIR__ . '/../../lib/Database.php';
|
require_once __DIR__ . '/../../src/Database.php';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$db = new Database();
|
$db = new Database();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/../../config/bootstrap.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 no password is configured, nothing to log into — go straight to admin.
|
||||||
if (!defined('ADMIN_PASSWORD_HASH')) {
|
if (!defined('ADMIN_PASSWORD_HASH')) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/../../config/bootstrap.php';
|
require_once __DIR__ . '/../../config/bootstrap.php';
|
||||||
require_once __DIR__ . '/../../lib/AdminAuth.php';
|
require_once __DIR__ . '/../../src/AdminAuth.php';
|
||||||
|
|
||||||
AdminAuth::logout();
|
AdminAuth::logout();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
// Bootstrap application
|
// Bootstrap application
|
||||||
require_once __DIR__ . "/../../config/bootstrap.php";
|
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)
|
// PHP-level auth guard (defence-in-depth behind nginx Basic Auth)
|
||||||
AdminAuth::requireLogin();
|
AdminAuth::requireLogin();
|
||||||
@@ -11,7 +11,7 @@ ini_set('display_errors', 0);
|
|||||||
ini_set('log_errors', 1);
|
ini_set('log_errors', 1);
|
||||||
ini_set('error_log', 'error.log');
|
ini_set('error_log', 'error.log');
|
||||||
|
|
||||||
require __DIR__ . '/../../lib/Database.php';
|
require_once __DIR__ . '/../../src/Database.php';
|
||||||
|
|
||||||
// Security: Validate thesis ID parameter
|
// Security: Validate thesis ID parameter
|
||||||
$thesisId = null;
|
$thesisId = null;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ try {
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>Recherche - Posterg</title>
|
<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/common.css">
|
||||||
<link rel="stylesheet" href="assets/search.css">
|
<link rel="stylesheet" href="assets/search.css">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<meta name="author" content="">
|
<meta name="author" content="">
|
||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
<title><?= isset($pageTitle) ? htmlspecialchars($pageTitle) . ' - Posterg' : 'Posterg' ?></title>
|
<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">
|
<link rel="stylesheet" href="assets/common.css">
|
||||||
<?php if (isset($additionalCSS)): ?>
|
<?php if (isset($additionalCSS)): ?>
|
||||||
<?php foreach ((array)$additionalCSS as $css): ?>
|
<?php foreach ((array)$additionalCSS as $css): ?>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>Posterg</title>
|
<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/common.css">
|
||||||
<link rel="stylesheet" href="assets/main.css">
|
<link rel="stylesheet" href="assets/main.css">
|
||||||
<?php if (php_sapi_name() === 'cli-server'): ?>
|
<?php if (php_sapi_name() === 'cli-server'): ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user