Files
xamxam/app/bootstrap.php
Pontoporeia dfde88eaa5 Migrate all <img>-based icons to inline SVG via PHP helper
Replace every <img src="/assets/icons/..."> with <?= icon('name') ?>
across 26 template files. The PHP helper inlines the SVG markup into the
DOM so CSS color cascades naturally through fill="currentColor".

- Add src/icon.php helper: reads SVG file, sets width/height to 1em,
  injects aria-hidden, supports optional CSS class
- Fix 12 icon SVGs that had hardcoded fill="#000000" or missing fill attr
- Replace search.svg with Phosphor fill-based magnifying glass
- Add explicit SVG sizes for admin header nav icons (16px/20px)
- Scope public search icon CSS to form[role=search]:not(.header-search-form)
  to avoid breaking admin header layout; change stroke to fill
- Remove <img> filter: brightness(0) invert(1) hacks from admin.css
2026-06-21 17:52:27 +02:00

59 lines
2.1 KiB
PHP

<?php
/**
* Simple configuration for website
*/
// Composer autoloader (vendor/ may be sibling dir in dev or same dir in prod)
$autoloadPath = file_exists(__DIR__ . '/vendor/autoload.php')
? __DIR__ . '/vendor/autoload.php'
: __DIR__ . '/../vendor/autoload.php';
require_once $autoloadPath;
// Define application root
define('APP_ROOT', __DIR__);
// Storage directory for uploaded files — intentionally outside the webroot
// so no uploaded content is ever directly web-accessible (items #3 & #4).
// Files are served through MediaController which validates paths and MIME types.
// In dev (cli-server) use the local storage/ directory; in production use the
// absolute path outside the webroot.
define('STORAGE_ROOT', php_sapi_name() === 'cli-server'
? __DIR__ . '/storage'
: '/var/www/xamxam/storage'
);
// Error reporting
if (php_sapi_name() === 'cli-server') {
// Development mode
error_reporting(E_ALL);
ini_set('display_errors', '1');
} else {
// Production mode
error_reporting(E_ALL);
ini_set('display_errors', '0');
ini_set('log_errors', '1');
}
// Admin password hash is stored in site_settings (DB).
// AdminAuth reads it on demand — no static config file needed.
// Central application helper (boot, auth guard, CSRF, flash, render)
require_once APP_ROOT . '/src/App.php';
require_once APP_ROOT . '/src/icon.php';
// Maintenance mode gate — block public pages; allow /admin/ through.
// The flag file lives in storage/ (outside webroot) to avoid web exposure.
define('MAINTENANCE_FLAG', APP_ROOT . '/storage/maintenance.flag');
if (file_exists(MAINTENANCE_FLAG)) {
// Allow admin panel, partage pages (path prefix), and the maintenance page itself
$requestPath = $_SERVER['REQUEST_URI'] ?? '';
$isAdmin = str_starts_with($requestPath, '/admin');
$isPartage = str_starts_with($requestPath, '/partage');
$isMaintenance = str_contains($requestPath, 'maintenance.php');
if (!$isAdmin && !$isPartage && !$isMaintenance) {
require APP_ROOT . '/public/maintenance.php';
exit();
}
}