38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
// Einstiegspunkt der Anwendung, Routing zur jeweiligen Modul-Seite
|
|
|
|
require_once __DIR__ . '/bootstrap.php';
|
|
requireAuth();
|
|
|
|
$module = $_GET['module'] ?? 'dashboard';
|
|
$action = $_GET['action'] ?? 'list';
|
|
|
|
$validModules = ['dashboard', 'locations', 'buildings', 'rooms', 'device_types', 'devices', 'racks', 'floors', 'floor_infrastructure', 'connections', 'port_types'];
|
|
$validActions = ['list', 'edit', 'save', 'ports', 'delete', 'swap'];
|
|
|
|
if (!in_array($module, $validModules, true)) {
|
|
renderClientError(400, 'Ungueltiges Modul');
|
|
exit;
|
|
}
|
|
|
|
if (!in_array($action, $validActions, true)) {
|
|
renderClientError(400, 'Ungueltige Aktion');
|
|
exit;
|
|
}
|
|
|
|
if (!in_array($action, ['save', 'delete', 'swap'], true)) {
|
|
require_once __DIR__ . '/templates/header.php';
|
|
}
|
|
|
|
$modulePath = __DIR__ . "/modules/$module/$action.php";
|
|
|
|
if (file_exists($modulePath)) {
|
|
require_once $modulePath;
|
|
} else {
|
|
renderClientError(404, 'Die angeforderte Seite existiert nicht.');
|
|
}
|
|
|
|
if (!in_array($action, ['save', 'delete', 'swap'], true)) {
|
|
require_once __DIR__ . '/templates/footer.php';
|
|
}
|