Version 1.5
This commit is contained in:
36
httpdocs/index.php
Normal file
36
httpdocs/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/app/bootstrap.php';
|
||||
require __DIR__ . '/app/views.php';
|
||||
|
||||
if (!function_exists('renderHeader') || !function_exists('renderAppShell')) {
|
||||
http_response_code(500);
|
||||
echo 'Application bootstrap failed.';
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($pdo && !isInstalled($pdo)) {
|
||||
header('Location: /install.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$page = $_GET['page'] ?? 'dashboard';
|
||||
if (!currentUser() && !in_array($page, ['login', 'reset_password'], true)) {
|
||||
$page = 'login';
|
||||
}
|
||||
|
||||
$current = currentUser();
|
||||
if ($current && ($current['role'] ?? '') === 'member' && in_array($page, ['members', 'admin', 'administration'], true)) {
|
||||
$page = 'dashboard';
|
||||
}
|
||||
|
||||
renderHeader(pageTitle($page));
|
||||
if ($page === 'login') {
|
||||
renderLoginPage();
|
||||
} elseif ($page === 'reset_password') {
|
||||
renderResetPasswordPage();
|
||||
} else {
|
||||
renderAppShell($page);
|
||||
}
|
||||
renderFooter();
|
||||
Reference in New Issue
Block a user