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:
+14
-2
@@ -4,6 +4,9 @@ require_once __DIR__ . '/../cms/core/index.php';
|
||||
|
||||
$config = include __DIR__ . '/../cms/core/config.php';
|
||||
|
||||
// Initialize dynamic logging
|
||||
LogManager::init($config['logging'] ?? []);
|
||||
|
||||
// Security headers
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
header('X-Frame-Options: SAMEORIGIN');
|
||||
@@ -114,8 +117,8 @@ $secSettings = $config['security'] ?? [
|
||||
$userAgent = $_SERVER['HTTP_USER_AGENT'] ?? '';
|
||||
$analyticsSettings = $config['analytics'] ?? [];
|
||||
$excludedIps = $analyticsSettings['excluded_ips'] ?? [];
|
||||
$isAllowedIp = in_array($clientIp, $secSettings['allowed_ips'] ?? [], true)
|
||||
|| in_array($clientIp, $excludedIps, true);
|
||||
$isAllowedIp = RequestLogger::ipMatchesList($clientIp, $secSettings['allowed_ips'] ?? [])
|
||||
|| RequestLogger::ipMatchesList($clientIp, $excludedIps);
|
||||
$requestStatus = 'ok';
|
||||
|
||||
if (!$isAllowedIp) {
|
||||
@@ -184,6 +187,15 @@ if (!str_starts_with($path, '/-media/') && !str_starts_with($path, '/-assets/'))
|
||||
$geoCountry
|
||||
);
|
||||
|
||||
// Also record through the dynamic log manager (requests event)
|
||||
LogManager::log(LogManager::EVENT_REQUESTS, 'info', 'Request: ' . $currentPage, [
|
||||
'ip' => $storedIp,
|
||||
'page' => $currentPage,
|
||||
'status' => $requestStatus,
|
||||
'country' => $geoCountry,
|
||||
'user' => $loggedInUser,
|
||||
]);
|
||||
|
||||
// Record aggregated statistics
|
||||
if (!empty($analyticsSettings['enabled']) && !in_array($clientIp, $excludedIps, true)) {
|
||||
$analytics = new Analytics($analyticsSettings);
|
||||
|
||||
Reference in New Issue
Block a user