Files
CodePress/cms/core/config.php
Edwin Noorlander dc0d370e65 Media browser: recursive scan entire content/ tree, /-media/ URL prefix, editor change detection fix
- handleMediaList() now scans content/ recursively for all media files
- URLs use /-media/ prefix mapping directly to content/ (no special cases)
- index.php: added /-media/ route, kept /-assets/ for backward compat
- editor-toolbar.js: fixed editor.on('change') placement (was inside switchMode)
- content-edit.php and content-new.php: back-btn unsaved-changes detection
- Removed unused __editorCleanup global
2026-06-24 17:00:59 +02:00

41 lines
1.4 KiB
PHP

<?php
// Simple configuration loader
$configJsonPath = __DIR__ . '/../../config.json';
if (file_exists($configJsonPath)) {
$jsonContent = file_get_contents($configJsonPath);
$config = json_decode($jsonContent, true);
if (json_last_error() === JSON_ERROR_NONE && is_array($config)) {
// Convert relative paths to absolute
$projectRoot = __DIR__ . '/../../';
if (isset($config['content_dir']) && strpos($config['content_dir'], '/') !== 0) {
$config['content_dir'] = $projectRoot . $config['content_dir'];
}
if (isset($config['templates_dir']) && strpos($config['templates_dir'], '/') !== 0) {
$config['templates_dir'] = $projectRoot . $config['templates_dir'];
}
// Load active theme
$activeTheme = $config['active_theme'] ?? 'default';
$themeDir = __DIR__ . '/../../themes/' . $activeTheme;
$themeFile = $themeDir . '/theme.json';
if (file_exists($themeFile)) {
$themeConfig = json_decode(file_get_contents($themeFile), true);
$config['theme'] = $themeConfig;
} else {
$config['theme'] = [];
}
return $config;
}
}
// Fallback to minimal config
return [
'site_title' => 'CodePress',
'content_dir' => __DIR__ . '/../../content',
'templates_dir' => __DIR__ . '/../templates',
'default_page' => 'auto'
];