CMS 2.0 - Theme engine, logging, admin improvements
Major changes: - New ThemeManager with Twig templating and SCSS compilation - Dynamic themes system (themes/default, themes/demo) - LogManager with SQLite storage and syslog forwarding - RequestLogger with static helper methods - Admin UI overhaul (Bootstrap 5, dark mode) - Admin config page with logging and theme settings - Admin logs page with filters and search - Removed legacy Mustache templates - Removed test plugin and theme - Composer dependencies: Twig, scssphp, CommonMark, MaxMind GeoIP
This commit is contained in:
@@ -30,6 +30,26 @@ if (is_file($filePath)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Serve theme assets from the themes/ directory (e.g. /themes/default/js/theme.js)
|
||||
if (preg_match('#^/themes/([^/]+)/(.+)$#', $path, $m)) {
|
||||
$themeName = $m[1];
|
||||
$themeRel = $m[2];
|
||||
$themesDir = __DIR__ . '/../themes';
|
||||
$themeFile = $themesDir . '/' . $themeName . '/' . $themeRel;
|
||||
$realThemes = realpath($themesDir);
|
||||
$realFile = realpath($themeFile);
|
||||
if ($realFile && $realThemes && strpos($realFile, $realThemes) === 0 && is_file($realFile)) {
|
||||
$ext = strtolower(pathinfo($realFile, PATHINFO_EXTENSION));
|
||||
if (isset($mimeTypes[$ext])) {
|
||||
header('Content-Type: ' . $mimeTypes[$ext]);
|
||||
}
|
||||
readfile($realFile);
|
||||
return true;
|
||||
}
|
||||
http_response_code(404);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Admin routes: /admin/login → admin.php?route=login
|
||||
if (preg_match('#^/admin(?:/(.+))?$#', $path, $m)) {
|
||||
$_GET['route'] = $m[1] ?? 'dashboard';
|
||||
|
||||
Reference in New Issue
Block a user