feat: single entry point routing — convert to front controller pattern

- Create app/public/index.php as front controller (bootstrap + Dispatcher)
- Rewrite app/router.php for PHP dev server → all non-asset requests to index.php
- Update Dispatcher to render full page layouts (head+header+view+footer)
- Move public view templates into templates/public/ (home, search, tfe, about, repertoire)
- Delete dead direct-access public/*.php files (apropos, search, tfe, licence, repertoire)
- Add clean URL routes to Dispatcher (/search, /tfe, /repertoire, /apropos, /licence, /media)
- Remove .php extensions from all internal links (header, views, templates, URLs)
- Update OG tags in controllers to use clean URLs
- Update nginx posterg.conf → front-controller try_files pattern, block direct .php access
- Update header.php and search-bar.php form actions to clean URLs
- Switch AboutController nav key from 'nav' to 'currentNav' for consistency
This commit is contained in:
Pontoporeia
2026-04-20 12:41:55 +02:00
parent 75f808bee4
commit de2e7a61ee
22 changed files with 515 additions and 695 deletions

34
TODO.md
View File

@@ -38,16 +38,34 @@
- [ ] Update Dispatcher to handle all routes directly (no require APP_ROOT/public/*.php)
### Phase 2: Single entry point
- [ ] Create app/public/index.php as front controller
- [ ] Bootstrap + Dispatcher invocation
- [ ] Remove direct-access public/*.php (index.php, search.php, tfe.php, apropos.php, licence.php)
- [ ] Rename old entry points so they can't be hit directly (e.g., prefix with underscore or delete)
- [x] Create app/public/index.php as front controller
- [x] Move bootstrap logic into entry point (bootstrap.php stays for admin)
- [x] Load and invoke Dispatcher
- [x] Move old public/*.php views into templates/public/
- [x] search.php → templates/public/search.php
- [x] tfe.php → templates/public/tfe.php
- [x] apropos.php → templates/public/about.php
- [x] repertoire.php → templates/public/repertoire.php
- [x] Delete old direct-access public/*.php files
- [x] Delete public/index.php (replaced by front controller)
- [x] Delete public/search.php
- [x] Delete public/tfe.php
- [x] Delete public/apropos.php
- [x] Delete public/licence.php
- [x] Delete public/repertoire.php
- [x] Update Dispatcher.render to use templates/public/ views
- [x] Update Dispatcher to render full pages (head + header + view + footer) instead of requiring bootstrap
- [x] Ensure admin/index.php bootstraps its own path (not affected by front controller)
### Phase 3: Server config
- [ ] Update router.php — route all PHP requests to Dispatcher
- [ ] Update nginx config — point all public routes to index.php via try_files
- [ ] Replace per-file `location ~ \.php$` with front-controller pattern
### Phase 4: Cleanup
- [ ] Delete app/public/live-reload.php (already handled by LiveReloadController)
- [ ] Test all routes (/, search.php, tfe, repertoire, apropos, licence, media, live-reload)
- [x] Clean URL updates
- [x] Remove .php from all internal links (header, views, controllers)
- [x] Add clean routes to Dispatcher (/search, /tfe, /media)
- [x] Update og:url tags in controllers to use clean URLs
- [x] Update TfeController redirect to /
- [x] Update header.php action URLs
- [x] Commit current state
- [ ] Test all routes (/, /search, /tfe, /repertoire, /apropos, /licence, /media, /live-reload)