Commit Graph

349 Commits

Author SHA1 Message Date
Pontoporeia
e126e1a3b0 refactor: use encapsulated Database methods in formulaire.php and edit.php 2026-03-28 13:49:51 +01:00
Pontoporeia
71167b2cdf fix: remove DB_ENV auto-detection; require explicit DB_ENV=test for tests
src/config.php: remove the file-existence fallback that silently redirected
all requests to test.db whenever that file was present on disk. getDatabasePath()
now always returns the production DB unless DB_ENV=test is explicitly set.

tests/run-tests.php: putenv('DB_ENV=test') at the top so the suite always
targets test.db regardless of what is set in the shell environment.

tests/Unit/DatabaseTest.php, tests/Integration/SearchTest.php,
tests/Security/SecurityTest.php: same putenv() guard added to each file so
they work correctly when run standalone (e.g. just test-unit).

justfile: all test and DB-development recipes now prefix DB_ENV=test to their
php/sqlite3 commands, making the intent explicit in the recipe itself.

Fixes: a developer who ran the test suite and kept test.db on disk would
silently hit test data when browsing the local site with no DB_ENV set.
2026-03-28 13:43:04 +01:00
Pontoporeia
7d96a08324 perf: replace fat-view student index query with lean getPublishedAuthors()
The répertoire page was loading the full v_theses_public view
(15 JOINs + 8 GROUP_CONCAT temp B-trees) via getAllPublishedTheses()
just to build the student name → thesis-id map on the index page.
Only two columns (id, authors) were ever consumed by the template.

Add Database::getPublishedAuthors(): array
- Queries thesis_authors JOIN authors directly on the theses base table
- Filters on theses.is_published = 1 using the existing index
- Returns only id + GROUP_CONCAT(authors) — no view expansion
- Results verified identical to the old getAllPublishedTheses() output

Update search.php to call getPublishedAuthors() instead.
Mark getAllPublishedTheses() @deprecated in Database.php.

All tests pass.
2026-03-28 13:35:43 +01:00
Pontoporeia
1181cfa88b encapsulate raw PDO queries leaking from callers into Database.php methods
- Add getThesisAccessTypeId(int $id): ?int — replaces raw SELECT in tfe.php
- Add getCoverPathsForTheses(array $ids): array — replaces raw SELECT/IN query in index.php
- Add getFileVisibility(string $path): ?int — replaces raw join query in media.php
- Add getThesisBannerPath(int $id): ?string — replaces unparameterised SQL injection in
  edit.php (SELECT banner_path FROM theses WHERE id = $thesisId was interpolating $thesisId
  directly into the query string; now parameterised via prepared statement)
- Add getThesisRawFields(int $id): ?array — replaces raw SELECT license_id/access_type_id/
  context_note in edit.php
- Add getThesisCount(): int — replaces raw SELECT COUNT(*) in system.php

Callers updated: public/tfe.php, public/index.php, public/media.php,
public/admin/edit.php, public/admin/system.php
2026-03-28 13:32:34 +01:00
Pontoporeia
20e5f71634 Fix two backend correctness issues
- Wrap setThesisJury() in a transaction: the method did a DELETE then multiple
  INSERTs with no atomicity guarantee. A partial failure (e.g. findOrCreateSupervisor
  throwing) would leave the jury table with orphaned rows. The fix uses
  pdo->inTransaction() to avoid nesting when called from within an outer transaction,
  and performs beginTransaction/commit/rollBack otherwise.

- Replace raw PDO query in admin/thanks.php with db->getThesisFiles(): the file
  listing after TFE submission was manually preparing a SELECT on thesis_files
  instead of calling the existing Database::getThesisFiles() method. Removes the
  getPDO() call entirely from that file.
2026-03-28 13:28:24 +01:00
Pontoporeia
69e161ada3 fix(admin): stats bar always shows whole-DB counts, not filtered counts
admin/index.php showed "TFE total / Publiés / En attente" by running
array_filter() over the already-filtered $theses array returned by
getThesesList(). When any search or year filter was active the three
numbers reflected only the matching subset, making the stats misleading
(e.g. searching for a single student would show "1 total, 0 publiés").

Add Database::getThesesStats(): array — a single SQL aggregation query:
  SELECT COUNT(*), SUM(is_published), SUM(NOT is_published) FROM theses

This runs against the raw theses table with no filters, so the counters
always display the true whole-database figures regardless of what filter
the admin has active. admin/index.php now calls getThesesStats() and
reads $stats['total'], $stats['published'], $stats['pending'] instead
of the array_filter expressions.
2026-03-28 11:42:44 +01:00
Pontoporeia
2e277b104e refactor(Database): remove dead CRUD helpers and alias proliferation
Remove 5 unused ID-lookup helpers (getOrientationId, getAPProgramId,
getFinalityId, getLanguageId, getFormatId) — forms have always passed
FK ids directly from <select> elements; these methods were never called
outside import.php, which now uses inline PDO queries instead.

Collapse 13 alias methods down to the single canonical name for each:
  getAllOrientations, getAllAPPrograms, getAllFinalityTypes,
  getAllFormatTypes, getAllLanguages, getAllLicenseTypes,
  getUsedTags, findOrCreateTag

The short-name variants (getOrientations, getApPrograms, etc.) and
compat aliases (getUsedKeywords, findOrCreateKeyword, getAllLicenseTypes
delegating to getLicenseTypes) are deleted. All call-sites updated:
  - public/search.php: getOrientations→getAllOrientations, etc.
  - public/admin/import.php: findOrCreateKeyword→findOrCreateTag,
    thesis_keywords→thesis_tags, keyword_id→tag_id (fixes stale table
    reference from pre-migration-001 that bypassed the M2M rename)
  - tests/Unit/DatabaseTest.php: remove alias smoke-test (test 7)

Database.php: 948 → 848 lines (-100).
2026-03-28 11:35:23 +01:00
Pontoporeia
b0632b4772 fix(formulaire): remove htmlspecialchars from sanitize_string + delete dead $problematique
HTML-escaping at write time stores &amp;, &lt; etc. in the DB, corrupting full-text
search, tag matching, exports, and any non-HTML consumer. PDO parameterised queries
already prevent SQL injection; templates call htmlspecialchars() on output.

sanitize_string() now does strip_tags(trim()) only — matching the pattern already
used by edit.php which never had this bug.

Also deleted the dead $problematique variable (read from POST[problématique] but
never passed to any INSERT or used anywhere in the codebase).
2026-03-27 23:16:12 +01:00
Pontoporeia
f37069720a schema: add composite index (is_published, year DESC) + fix stale migration 005
- Add idx_theses_pub_year composite index on theses(is_published, year DESC) to
  schema.sql; replaces the need for the query planner to pick between the two
  separate idx_theses_published / idx_theses_year indexes and sort with a temp
  B-tree. Every public query filters on is_published=1 and orders/filters by year,
  so this covering index eliminates the sort pass for those queries.

- Create storage/migrations/006_add_composite_index.sql and apply to both
  posterg.db and test.db.

- Fix storage/migrations/005_add_banner.sql: the view recreation in that file
  still referenced the pre-migration-001 table/column names (thesis_keywords,
  keywords.keyword). Updated to use thesis_tags / tags tg to match the canonical
  schema.sql. The live DB was unaffected (migration 001 ran before 005), but the
  file was misleading and would fail if ever re-run from scratch.
2026-03-27 13:48:22 +01:00
Pontoporeia
42af4644c5 perf+a11y: WAL mode for SQLite, skip links, :focus-visible, .sr-only
SQLite performance (Database::__construct):
- PRAGMA journal_mode = WAL: eliminates full-DB read locks on write, safe
  for concurrent PHP-FPM workers
- PRAGMA synchronous = NORMAL: durable on commit without full fsync per write
- PRAGMA cache_size = -8000: ~8 MB page cache per connection

Accessibility foundation (WCAG 2.1 AA):
- common.css: add .sr-only utility, .skip-link (hidden until focused),
  global :focus-visible (2px purple outline, 2px offset),
  prefers-reduced-motion guard; remove bare outline:none from
  .site-search__input
- admin.css: same :focus-visible, skip-link, and motion guard scoped to
  admin purple; remove outline:none from .admin-input/.admin-select/
  .admin-textarea and .admin-filters select (both had :focus border rules
  already, so focus is still visually communicated)
- search.css: remove outline:none from .search-filter-select (already has
  :focus border-color rule)
- All 5 public pages (index, search, tfe, apropos, licence): add
  <a href="#main-content" class="skip-link"> as first child of <body>;
  add id="main-content" to <main>
- templates/admin/head.php: same skip link; aria-label="Navigation admin"
  on <nav>; id="main-content" on all 10 admin <main> elements

All 4 test suites pass (unit, integration, security, rate-limit).
2026-03-27 13:45:01 +01:00
Pontoporeia
a9877b1d1d docs: accessibility audit — add WCAG 2.1 AA analysis to TODO.md
Measured contrast ratios, traced every interactive element, checked all four
WCAG principles across public and admin surfaces. Current state confirmed:
zero ARIA attributes, zero skip links, zero focus-visible styles, zero
prefers-reduced-motion guards in the live codebase.

Key failures by criterion:

1.1.1: TFE file images use raw filename as alt; search bar SVG not aria-hidden;
       jury remove buttons have no accessible name (bare ✕)

1.3.1: TFE metadata is div/span soup with no programmatic label-value association;
       search filter selects have no associated label; checkbox groups need fieldset/legend

1.4.1: Status badges distinguish state by colour only; active nav link has no
       non-colour indicator and its CSS class has no rule at all

1.4.3 (measured failures):
  - Nav links at opacity:0.92 on purple: 4.05:1 (fails AA 4.5:1)
  - filter-info purple text on purple-light bg: 4.08:1 (fails AA)
  - Placeholder #aaa on white: 2.32:1 (fails AA)
  - Gradient cards: white text on L=65% HSL — every warm hue fails AA,
    some as low as 1.46:1 (yellow). Only blue/indigo hues pass.
  - admin-text-muted #888 on bg-alt #242424: 4.38:1 (fails AA)
  - admin-purple on dark bg: 3.57:1 (fails for normal text size)

1.4.10: Répertoire 4-column grid has no mobile breakpoint
1.4.11: Search select border #ddd on white: 1.6:1; admin input border: 1.8:1

2.1.1: Disabled pagination links have pointer-events:none but remain keyboard-focusable
2.4.1: No skip-to-main link anywhere in the site
2.4.4: Pagination arrows (« ‹ › ») have no aria-label
2.4.6: tfe.php h1=author h2=title is inverted; index/search have no h1 at all
2.4.7: No :focus-visible defined anywhere; outline:none suppresses browser default
       on search input with no replacement

3.1.1: 429 response has no lang attribute
3.3.1: Form errors not announced as live regions; no autofocus on invalid field
3.3.2: Search input has no label, only placeholder

4.1.1: pages-edit.php has <link> in <body>
4.1.2: <video> has no caption track; <embed> PDF has no fallback download link;
       bulk action results not announced to AT

Motion: no prefers-reduced-motion guard on any transition or animation

Infrastructure gaps: no .sr-only class, no skip link, no :focus-visible,
four explicit outline:none suppressions with no replacement
2026-03-26 23:04:21 +01:00
Pontoporeia
22fabeb447 docs: semantic HTML audit admin section — add sections VIII–XVI to TODO.md
Analysed every admin template against semantic HTML:

templates/admin/head.php (VIII):
- Nav links are bare <a> in flat <nav>, no <ul>/<li> structure
- No aria-label on <nav>, active state uses .active class not aria-current=page
- Déconnexion link has inline style for positioning

add.php / edit.php (IX):
- ~20 <div class=admin-form-row> wrappers removable with CSS grid on form directly
- Inner anonymous <div> wrapping input+hint → <small> removes the wrapper
- <div class=admin-checkbox-list> + <label class=admin-checkbox-label> → <ul>/<li label>
- <div class=admin-submit-wrap> → remove, style button directly
- <div class=admin-alert> → <p role=alert> / <p role=status>

index.php (X):
- Stats <div> soup → <dl>/<dt>/<dd> (numbers as defined terms)
- Maintenance bar <div> → <aside role=status>
- Bulk toolbar → role=toolbar aria-label
- <th> cells missing scope=col

tags.php (XI):
- <th> cells missing scope=col; inline margins on sibling forms → CSS selector

thanks.php (XII):
- <div class=admin-thesis-info> already uses <dl> inside — wrap in <section> instead

account.php (XIII):
- Status rows <div> soup → <dl>/<dt>/<dd>
- Danger zone description <div> → <p>
- Inline margin on section title → CSS

login.php (XIV):
- No <main> landmark on the page
- Inline styles on form rows → modifier class

pages-edit.php (XV):
- <link> stylesheet injected inside <body> (invalid) — move to <head> via $extraCss

Summary table: 15 additional admin classes deletable via semantic replacements
2026-03-26 22:58:15 +01:00
Pontoporeia
bc5c50f1fb docs: semantic HTML audit — add section I–VII to TODO.md
Full analysis of every public-facing page and partial against semantic HTML.
Currently only one semantic element exists across the entire public frontend (<nav>).

Key findings mapped to concrete replacements:

nav.php: <div class=site-nav__links> → <ul>/<li>; active class → aria-current=page
         search <form> needs role=search, aria-label, hidden SVG icon

index.php: <div class=cards-container> → <ul>; card <div>s → <li>; <a> wraps directly
           card__media → <figure> for image cards; pagination divs → <nav><ul>
           disabled pagination links need aria-disabled + tabindex=-1, not just a class

search.php: filter label+div groups → <label> wrapping <select> (removes 2 classes per group)
            .search-results-view wrapper → remove (redundant inside <main>)
            results-grid <div> → <ul>; result-card__meta <span> → <small>
            repertoire columns <div> → <section>; link lists → <ul>/<li>
            active links → aria-current=page

tfe.php: heading hierarchy is backwards — author is h1, title is h2; should be reversed
         .tfe-layout → <article>; .tfe-left → <header> inside article
         .tfe-meta-list div+span soup → <dl>/<dt>/<dd> (removes ~30 wrapper divs + 5 classes)
         .tfe-right → <aside>; .tfe-media-block → <figure>; caption → <figcaption>
         .tfe-synopsis-text <div> → <p>; back link wrapper div → remove

apropos.php: .apropos-right <div> → <aside>; contact divs → <address>
             section wrapper divs → <section>; two CSS classes → strong + a[href^=mailto:]
             double-class .apropos-description.apropos-page-content → single .prose

licence.php: remove always-empty right column and two-column layout entirely

Summary table: 25+ classes that become deletable once semantic elements carry the meaning
2026-03-26 22:53:47 +01:00
Pontoporeia
7d836c165c docs: frontend & template audit — add sections D–H to TODO.md
Analysed all public pages, CSS files, and template partials. Found:

Template structure (D):
- <head> boilerplate duplicated across 5 public pages (no shared partial exists)
- Live-reload snippet copy-pasted into 6 files
- templates/header.php and templates/head.php are dead/orphaned files
- public/assets/icons.svg is a dead TrumboWYG sprite (never referenced, ~15 KB)
- admin_favicon.svg used as public favicon (misleading naming)

CSS (E):
- html/body reset block repeated in 4 page stylesheets; belongs in common.css
- @font-face missing font-display:swap (FOIT risk)
- Search pagination is fully inline-styled; home page already has .pagination-btn classes
- Multiple one-off inline styles across tfe.php, edit.php, index.php
- .site-nav__right is a CSS duplicate of .site-nav__link
- .site-nav__link--active applied in PHP but has no CSS rule (invisible active state)

Template logic (F):
- 429 rate-limit response is bare unstyled HTML
- apropos.php contacts/credits hardcoded (require code deploy to change)
- licence.php wastes half the viewport with an always-empty right column

Accessibility (G):
- <nav> has no aria-label; search <form> has no accessible name
- No <meta name=description> on any public page
- No Open Graph tags anywhere (blank previews when sharing thesis links)

Minor (H):
- thanks.php duplicates getThesisFiles() with a raw query
- admin/index.php stats broken when filters are active (PHP array_filter on subset)
2026-03-26 22:51:16 +01:00
Pontoporeia
72daf46c46 docs: backend audit — add refactor & maintenance task list to TODO.md
Full analysis of PHP and SQLite layer covering:

Performance:
- WAL mode + cache_size pragma missing from Database constructor
- Separate is_published/year indexes force temp B-tree sort on every public query
- v_theses_full materialised as CTE on every query, indexes never used by view
- getAllPublishedTheses() runs full 15-join view just for the author name index

PHP / Database.php:
- 5 dead CRUD helpers (getOrientationId etc.) never called anywhere
- 13 alias methods doubling every lookup; pick canonical names and remove
- getPDO()/getConnection() leaking to 8 call-sites with raw SQL that belongs in DB layer
- Unparameterised query in edit.php line 155 (SQL injection, fix immediately)
- sanitize_string() HTML-escapes at write time — stores &amp; in DB, breaks search/export
- Dead variable $problematique in formulaire.php (read from POST, never used)
- setThesisJury() has no transaction guard of its own
- DB config auto-detection silently uses test.db if file exists locally

Maintainability:
- edit.php (530 lines) mixes display + POST + file upload — extract action file
- Banner upload logic copy-pasted between formulaire.php and edit.php
- Junction-table loops open-coded in every action; add setThesisLanguages/Formats/Tags
- RateLimit writes a JSON file on every public request
- __wakeup() throws from public method (PHP 8 deprecation)
2026-03-26 22:42:35 +01:00
Pontoporeia
b12ae73e91 tests: fix SecurityTest fatal TypeError — update searchTheses call to use array params
SecurityTest::Test1 was calling $db->searchTheses($string) with a plain
string, but searchTheses() was refactored to require array $params when
the tag M2M work landed.  This caused an immediate PHP fatal TypeError
before any SQL ever ran, killing the entire Security test suite with
exit code 255 and masking all three tests.

Fix: pass each malicious payload via ['query' => $string] which is the
correct API and properly exercises the parameterised query path through
validateSearchParams() + buildSearchConditions().  Added a clarifying
comment explaining why the array form is required.

All 4 test suites now pass:
  - Database (Unit):   7/7
  - Rate Limit (Unit): 5/5
  - Search (Integration): 6/6
  - Security:          3/3
2026-03-26 18:54:20 +01:00
Pontoporeia
e4be230a04 admin/system: add nginx config viewer tab
Add a 'nginx — config' tab to the Système admin page (system.php).

- Reads /etc/nginx/sites-available/posterg (live deployed config) first;
  falls back to nginx/posterg.conf (local reference copy) when the live
  path is inaccessible (e.g. in dev, or wrong permissions).
- Displays a colour-coded badge: green '● Config déployée' for live,
  amber '⚠ Référence locale' for the fallback.
- Renders the full config in the shared .log-output code block with
  line numbers (data-n gutter via CSS ::before) and lightweight nginx
  syntax colouring (comments grey, block keywords purple, directives blue).
- Reuses the existing copy-to-clipboard button.
- Tab routing: activeTab validation extended to accept 'nginx_config';
  log pre-loading guards skip when activeTab is 'nginx_config'.
- No remote execution: read-only, zero new attack surface.
2026-03-26 11:23:18 +01:00
Théophile Gervreau-Mercier
45acadaa0a Instructions pour DEV sur MACOS → DEV.md 2026-03-24 18:23:40 +01:00
Pontoporeia
37f3a07c6e admin: merge status + logs into unified system.php with instant tabs
Replace the separate /admin/status.php and /admin/logs.php pages with a
single /admin/system.php page organised around a tab bar.

- system.php — top-level tab bar: 'Statut' + one tab per log file
  (nginx accès, nginx erreurs, PHP-FPM).  Switching tabs is a plain
  href (?tab=…) so no JS required for navigation; the lines-selector
  SELECT triggers a location change on 'change' for instant reload
  without a submit button.
- Status tab preserves all existing service cards, PHP runtime grid,
  and disk-usage bar from the old status.php.
- Log tabs preserve line-count selector, file metadata bar, and
  per-line colour coding from the old logs.php.
- New: copy-to-clipboard button on each log output block (Clipboard
  API with textarea execCommand fallback).
- status.php / logs.php replaced with 301 redirect stubs so existing
  bookmarks and links keep working.
- templates/admin/head.php: 'Statut' + 'Journaux' nav items replaced
  with a single 'Système' item; active state covers all three page
  names for redirect compatibility.
2026-03-24 15:55:48 +01:00
Pontoporeia
ea48f4a5f5 todo: add system page merge + logs tab/copy tasks 2026-03-24 15:52:30 +01:00
Pontoporeia
20a633c0e2 Add admin account page for PHP password management
Implements the admin user management UI as a self-contained PHP password
change/set flow — no SSH or sudo required.

- public/admin/account.php: shows auth status (PHP hash present, credentials
  file path), password change form (requires current password when one exists,
  min 12 chars, confirm field), and a danger-zone form to delete the
  credentials file entirely
- public/admin/actions/account.php: CSRF-guarded POST handler; verifies
  current password via AdminAuth::login() before accepting a new one;
  generates bcrypt (cost 12) hash; writes config/admin_credentials.php
  atomically via a temp file + rename; regenerates session on success;
  redirects to /admin/login.php when credentials are deleted
- templates/admin/head.php: 'Compte' nav link added (active on account.php)
- public/assets/admin.css: .admin-account-status, .admin-section-title,
  .admin-field-hint, .admin-danger-zone component styles added

Note: the nginx htpasswd flow (manage-admin-users.sh) requires root on the
server and is intentionally kept as a CLI-only operation.
2026-03-24 15:52:00 +01:00
Pontoporeia
020bfa5a33 admin: add server log viewer; fix curl_close() PHP 8.5 deprecation in status.php
- public/admin/logs.php: new page tailing nginx error/access + PHP-FPM logs.
  Selector for log file and line count (50/100/200/500, default 100).
  Lines reversed (newest first), colour-coded by severity, numbered gutter.
  Graceful degradation when exec() unavailable or file unreadable (dev msg).

- templates/admin/head.php: 'Journaux' nav link added after 'Statut'.

- public/admin/status.php: remove curl_close() call deprecated in PHP 8.5
  (no-op since PHP 8.0); replace with unset($ch) to silence the warning
  that was leaking raw text above the page output.
2026-03-24 15:47:38 +01:00
Pontoporeia
c678b75494 Add admin server status page
New page /admin/status.php gives a real-time health dashboard:

- Services panel: nginx (systemctl), php-fpm (auto-detects versioned unit names),
  site HTTP ping (curl HEAD with latency), SQLite DB (exists/writable/row count/size),
  storage directory (writable, banner/cover file counts), maintenance-mode flag.
- PHP runtime panel: version, SAPI, memory_limit, upload_max_filesize, post_max_size,
  max_execution_time.
- Disk usage bar for the partition containing APP_ROOT (colour-coded: green/amber/red).
- All shell calls go through safeExec() which suppresses stderr and checks exit code;
  systemctl/curl unavailability degrades gracefully to 'unknown' without fatal errors.
- 'Statut' nav link added to templates/admin/head.php (active state on status.php).
2026-03-24 15:41:30 +01:00
Pontoporeia
ed2b06a34c feat: cover image fallback for home grid cards
- index.php: batch-load thesis_files covers for theses without banner_path
- Resolution order: banner_path → cover file → gradient placeholder
- Uses single IN() query to avoid N+1 problem
2026-03-24 15:39:23 +01:00
Pontoporeia
372abb5cd6 feat: tag management tests, maintenance mode polish, répertoire pagination fix
- tests/Unit/DatabaseTest.php: tests 5-7 for findOrCreateTag round-trip, getUsedTags column, alias
- tests/Integration/SearchTest.php: tests 4-6 for tag subquery, full-text query, count consistency
- Database: getAllPublishedTheses() bypasses 100-row search cap for student index
- search.php: uses getAllPublishedTheses() for étudiantes column; all tests pass
2026-03-24 15:38:36 +01:00
Pontoporeia
92e344b757 feat: admin tag management, maintenance mode, TFE visibility states
Tags admin:
- Database: getAllTagsWithCount(), renameTag(), mergeTag(), deleteTag()
- public/admin/tags.php: table with inline rename/merge/delete forms, CSRF-guarded
- public/admin/actions/tag.php: routes on action=rename|merge|delete
- templates/admin/head.php: 'Mots-clés' nav link
- admin.css: admin-inline-form, admin-btn--sm/warning/danger variants

Maintenance mode:
- config/bootstrap.php: gate on MAINTENANCE_FLAG file; admin/ and maintenance.php exempt
- public/maintenance.php: 503 dark minimal page
- public/admin/actions/maintenance.php: enable/disable toggle
- public/admin/index.php: status bar with toggle button
- admin.css: admin-maintenance-bar styles

TFE Visibility (Libre/Interne/Interdit via existing access_type_id):
- migration 002_add_visibility.sql: seeds access_types if missing
- Database: setVisibility(), bulkSetVisibility(), getAccessTypes()
- public/media.php: blocks thesis files for access_type_id=3
- public/tfe.php: shows access_type, context_note; hides file panel for Interdit
- public/admin/edit.php: access_type_id select + context_note textarea; saves both
- public/admin/index.php: three-state badge (Libre/Interne/Interdit) per row
- public/admin/actions/visibility.php: single + bulk visibility action handler
- admin.css: status-access badge variants
2026-03-24 15:35:52 +01:00
Pontoporeia
0933137540 refactor: rename keywords→tags M2M (migration 001)
- migration 001_rename_keywords_to_tags.sql: CREATE tags/thesis_tags from keywords/thesis_keywords,
  copy data, drop old tables, rebuild indexes and views
- schema.sql: tags table, thesis_tags junction, updated indexes and v_theses_full/v_theses_public
- Database.php: findOrCreateTag(), getUsedTags() with proper JOIN; backwards-compat aliases;
  buildSearchConditions uses EXISTS subquery on thesis_tags+tags with vp. alias throughout
- admin/actions/formulaire.php: INSERT OR IGNORE INTO thesis_tags
- admin/edit.php: DELETE FROM thesis_tags + findOrCreateTag
- search.php: $kw['name'] (was $kw['keyword'])
- fixtures/CreateTestDatabase.php: tags/thesis_tags table names
2026-03-24 13:30:53 +01:00
Pontoporeia
cefceb046c feat: jury composition + banner image upload
- migration 004: thesis_supervisors.role + is_external; view adds jury_president/jury_promoteurs/jury_lecteurs
- migration 005: theses.banner_path; view exposes t.banner_path and t.license_id
- Database: getThesisJury(), setThesisJury(), setBannerPath()
- admin/add.php: jury fieldset (président/promoteur/lecteurs + externe checkboxes, JS add/remove rows); banner file input
- admin/edit.php: jury fieldset pre-populated from DB; banner preview + remove checkbox + upload; multipart form
- admin/actions/formulaire.php: parse jury fields → setThesisJury(); banner upload to banners/
- tfe.php: three conditional jury rows (président·e, promoteur·ice, lecteur·ices)
- schema.sql: updated thesis_supervisors, theses, v_theses_full, v_theses_public definitions
- admin.css: fieldset, jury-row, jury-entry, btn-remove styles
2026-03-24 13:25:23 +01:00
Pontoporeia
d87348c388 feat: licence page, admin pages editor, license types, gradient card placeholders, latest-year home view
- Feature 1: public /licence.php fetches 'licenses' page from DB, renders Markdown
- Feature 1: nav.php adds 'Licence' link with active state
- Feature 2: Database::getPage(), savePage(), getAllPages() methods
- Feature 2: bundled src/Parsedown.php (MIT, zero-dependency)
- Feature 2: apropos.php now renders 'about' page content from DB via Parsedown
- Feature 2: admin/pages.php (list) + admin/pages-edit.php (EasyMDE editor)
- Feature 2: admin/actions/page.php (auth+CSRF+validation+save)
- Feature 2: admin/head.php adds 'Pages statiques' nav link
- Feature 3: storage/schema.sql seeds 8 CC license types
- Feature 3: storage/migrations/003_seed_license_types.sql (applied to live DB)
- Feature 3: Database::getLicenseTypes() / getAllLicenseTypes()
- Feature 3: admin/add.php + formulaire.php: license_id field on add form
- Feature 3: admin/edit.php: license_id field on edit form with raw FK lookup
- Feature 3: tfe.php: shows 'Licence :' meta row when non-null
- Feature 6: main.css: .card__media--gradient styles
- Feature 6: index.php: deterministic HSL gradient placeholder cards
- Feature 6: Database::getLatestYearTheses() + getLatestPublishedYear()
- Feature 6: index.php default home = random latest-year theses with info label
2026-03-24 13:12:48 +01:00
Pontoporeia
86a2082edc docs: add feature tasks for licence page, admin WYSIWYG, jury section, banner upload, and home randomisation 2026-03-24 12:55:22 +01:00
Pontoporeia
f8a4bfb612 docs: add maintenance mode + TFE visibility tasks to TODO 2026-03-24 12:40:55 +01:00
Pontoporeia
4131fc07e9 docs: add admin tag management UI task to TODO 2026-03-23 11:03:19 +01:00
Pontoporeia
6d2c50f0b9 docs: add M2M tags refactor task proposal to TODO 2026-03-23 11:00:21 +01:00
Pontoporeia
46040328a4 add flake.nix for Nix PHP dev shell 2026-03-11 12:39:18 +01:00
Pontoporeia
7208292c0e deploy-nginx: add recipe, upload scripts to /tmp, print sudo instructions 2026-03-02 16:08:45 +01:00
Pontoporeia
5e1543e9a8 nginx: relax admin rate limit to 60r/m burst=20 (was 10r/m burst=5) 2026-03-02 16:08:45 +01:00
Pontoporeia
1fb9644d5a fix favicon 404s: add <link rel=icon> to all pages, nginx 204 for /favicon.ico 2026-03-02 16:08:45 +01:00
Pontoporeia
e4b2205eac fix rsync permissions: setup-server.sh with setgid dirs, exclude .claude/.pi 2026-03-02 16:08:45 +01:00
Pontoporeia
52978aa658 ops: simplify justfile, guard deploy-db, extract scripts, fix .gitignore 2026-03-02 16:08:45 +01:00
Pontoporeia
2110d2b916 Redesign UI to match target design images
- Flat purple-gradient nav bar with POSTERG/RÉPERTOIRE/À PROPOS links
- Full-width search bar with icon, bottom-border only, below nav
- Home: white bg, media card grid (thumbnail + author/title label below)
- Répertoire: 4-column index (Années/Catégories/Étudiantes/Mots-clés)
- TFE: 2-column layout (large text left, media right)
- À Propos: 2-column, large monospace text, new apropos.php page
- Admin: dark theme (#1a1a1a), purple gradient nav, bottom-border inputs
- New shared partials: templates/nav.php, templates/search-bar.php
- Rewrote all CSS: common, main, search, tfe, apropos, admin
2026-02-24 23:34:17 +01:00
Pontoporeia
eaad740574 refactor: extract buildSearchConditions, add getThesesList, remove dead code, fix SearchTest
- Database: extract private buildSearchConditions(array $params): array shared by
  searchTheses() and countSearchResults(), eliminating ~80 lines of duplication;
  add array type hints to both public methods
- Database: add getThesesList(array $filters) and getAllYears() so admin/index.php
  no longer builds raw SQL inline
- admin/index.php: replace inline PDO query block with $db->getThesesList() /
  $db->getAllYears(); drop the now-unused $pdo local
- config/bootstrap.php: remove dead include_template() helper and the
  vendor/autoload.php Composer stub (no vendor/ directory exists)
- apps/: delete entire directory (leftover artefact, no code references it)
- tests/Integration/SearchTest.php: fix three searchTheses() calls from bare
  strings to proper array params to match the method signature (prevented TypeError)
2026-02-24 23:21:44 +01:00
Pontoporeia
d30153871f fix: resolve broken lib/ require paths in admin and normalise modern-normalize to .min.css 2026-02-24 23:19:18 +01:00
Pontoporeia
da53d56744 analysis: dependency audit and refactoring task proposals in TODO.md 2026-02-24 23:17:37 +01:00
Théophile Gervreau-Mercier
73c27a067d Make search page header more compact and fix layout structure
- Reduce all spacing and padding in header for more compact fit
- Fix back button overflow by removing width: 100% and adding overflow handling
- Make filter section more compact with smaller fonts and spacing
- Add main-wrapper div to group main and footer
- Keep rounded corners (40px) on all three sections like main.css
- Footer stays at bottom of main content area
- Fix HTML structure: footer outside main, both inside wrapper
2026-02-12 13:41:17 +01:00
Théophile Gervreau-Mercier
bc98df4993 Improve search page with denser header and filter layout
- Transform header into compact search bar with back button
- Move filters panel underneath search bar (collapsible)
- Display results in grid layout matching main.css style
- Add pagination controls in main section
- Show result count in footer
- Prevent overflow with responsive design and proper flex constraints
- Reduce padding and font sizes for denser layout
2026-02-12 13:22:09 +01:00
Théophile Gervreau-Mercier
061b2b540e Improve card layout: move pagination inside main, add responsive grid (3 rows × 4 cols = 12 items), display keywords as tags, optimize text sizes and spacing 2026-02-12 13:12:00 +01:00
Théophile Gervreau-Mercier
73b0093b26 feat: rename memoire to tfe and improve styling
- Rename memoire.php to tfe.php throughout codebase
- Create dedicated tfe.css with rounded header/main/footer layout
- Move metadata (orientation, AP program, finality, keywords) to header
- Move back button from header to footer
- Create shared templates/head.php for common HTML head section
- Maintain rounded borders (40px) matching main site design
- Keep purple header (#9557b5), green main (#3c856b), dark footer (#222)
- Improve content readability with centered max-width layout
- Add responsive design for mobile devices
2026-02-12 12:46:51 +01:00
Théophile Gervreau-Mercier
9f6147577b refactor: improve layout ratios and pagination UI
Layout improvements:
- Fixed header/main/footer ratios to 2:5, 3:5, 1:5 using flex
- Default to sans-serif font system stack
- Made sections properly flex-based instead of viewport height

Pagination improvements:
- First/previous/next/last navigation buttons (‹‹ ‹ › ››)
- Current page highlighted in colored badge
- Disabled state for unavailable actions
- Clean rounded button design with hover effects
- Proper spacing and visual hierarchy

Card styling:
- Better typography hierarchy
- Hover effects (lift + shadow)
- Improved spacing and readability
- Year displayed in brand color

Tests passing 
2026-02-12 12:30:40 +01:00
Théophile Gervreau-Mercier
9511bb93b5 feat: add year filter to main index
- Footer now displays all available years horizontally with scroll
- Click on year filters thesis list to that year
- Active year highlighted in footer
- 'Tous' link to reset filter
- Filter info banner shows when year selected with reset button
- Pagination preserves year filter
- Styled with horizontal scroll, smooth scrollbar
- Tests passing 
2026-02-12 12:26:32 +01:00
Théophile Gervreau-Mercier
942a93a3ad refactor: update nginx config for new structure
- Updated posterg.conf with new directory structure
- Document root: /var/www/posterg/public
- Explicitly deny access to: /src, /templates, /config, /storage, /tests, /scripts, /docs
- Added structure diagram in comments
- Updated deploy scripts security checks
- Replaced outdated posterg.conf.reference

All non-public directories outside webroot for security.
Defense-in-depth: explicit deny rules even though paths outside /public.
2026-02-12 12:20:31 +01:00