Add system update feature, git-ignore local configs, and fix homepage request logging
- Exclude config.json and admin.json in .gitignore so live settings/passwords are never overwritten by git - Auto-generate config.json and admin.json with defaults if missing - Add config.json.example and admin.json.example reference templates - Add System Update page (/admin/update) in Admin Console to pull updates via Git with 1 click - Log effective page name in index.php instead of literal 'auto' - Add extra HAProxy/PFSense proxy headers to RequestLogger::getClientIp()
This commit is contained in:
@@ -2,6 +2,42 @@
|
||||
|
||||
// Simple configuration loader
|
||||
$configJsonPath = __DIR__ . '/../../config.json';
|
||||
$configExamplePath = __DIR__ . '/../../config.json.example';
|
||||
|
||||
// Auto-create config.json if it does not exist
|
||||
if (!file_exists($configJsonPath)) {
|
||||
if (file_exists($configExamplePath)) {
|
||||
@copy($configExamplePath, $configJsonPath);
|
||||
} else {
|
||||
$defaultConfig = [
|
||||
'site_title' => 'CodePress',
|
||||
'content_dir' => 'content',
|
||||
'templates_dir' => 'cms/templates',
|
||||
'active_theme' => 'default',
|
||||
'default_page' => 'auto',
|
||||
'language' => [
|
||||
'default' => 'nl',
|
||||
'available' => ['nl', 'en']
|
||||
],
|
||||
'seo' => [
|
||||
'description' => 'CodePress CMS - Lightweight file-based content management system',
|
||||
'keywords' => 'cms, php, content management, file-based'
|
||||
],
|
||||
'author' => [
|
||||
'name' => 'E. Noorlander',
|
||||
'website' => 'https://noorlander.info'
|
||||
],
|
||||
'show_version' => true,
|
||||
'enabled_plugins' => ['MQTTTracker', 'HTMLBlock'],
|
||||
'features' => [
|
||||
'auto_link_pages' => true,
|
||||
'search_enabled' => true,
|
||||
'breadcrumbs_enabled' => true
|
||||
]
|
||||
];
|
||||
@file_put_contents($configJsonPath, json_encode($defaultConfig, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($configJsonPath)) {
|
||||
$jsonContent = file_get_contents($configJsonPath);
|
||||
|
||||
Reference in New Issue
Block a user