Files
netwatch/app/index.php
Troy Grunt 5066262fca feat: Implement initial application structure with network view and SVG editor
- Added network-view.js for visualizing network topology with devices and connections.
- Introduced svg-editor.js for managing ports on device types with drag-and-drop functionality.
- Created bootstrap.php for application initialization, including configuration and database connection.
- Established config.php for centralized configuration settings.
- Developed index.php as the main entry point with module-based routing.
- Integrated _sql.php for database abstraction.
- Added auth.php for single-user authentication handling.
- Included helpers.php for utility functions.
- Created modules for managing connections, device types, devices, and floors.
- Implemented database schema in init.sql for locations, buildings, floors, rooms, network outlets, devices, and connections.
- Added Docker support with docker-compose.yml for web and database services.
- Documented database structure and UI/UX concepts in respective markdown files.
2026-02-05 23:41:54 +01:00

68 lines
1.6 KiB
PHP

<?php
// Einstiegspunkt der Anwendung, Routing zur jeweiligen Modul-Seite
/**
* index.php
*
* Einstiegspunkt der Anwendung
* - Single-User
* - Modulbasiertes Routing
* - Basierend auf _sql.php
* - HTML-Layout via templates/layout.php
*/
/* =========================
* Bootstrap
* ========================= */
require_once __DIR__ . '/bootstrap.php'; // lädt config, DB, helper
// TODO: Session starten / Single-User-Auth prüfen
/* =========================
* Routing
* ========================= */
// Standard-Modul / Aktion
$module = $_GET['module'] ?? 'dashboard';
$action = $_GET['action'] ?? 'list';
// Whitelist der Module
$validModules = ['dashboard', 'device_types', 'devices', 'racks', 'floors', 'connections'];
// Whitelist der Aktionen
$validActions = ['list', 'edit', 'save', 'ports'];
// Prüfen auf gültige Werte
if (!in_array($module, $validModules)) {
// TODO: Fehlerseite anzeigen
die('Ungültiges Modul');
}
if (!in_array($action, $validActions)) {
// TODO: Fehlerseite anzeigen
die('Ungültige Aktion');
}
/* =========================
* Template-Header laden
* ========================= */
require_once __DIR__ . '/templates/header.php';
// TODO: ggf. Navigation einbinden
/* =========================
* Modul laden
* ========================= */
$modulePath = __DIR__ . "/modules/$module/$action.php";
if (file_exists($modulePath)) {
require_once $modulePath;
} else {
// TODO: Fehlerseite oder 404
echo "<p>Die Seite existiert noch nicht.</p>";
}
/* =========================
* Template-Footer laden
* ========================= */
require_once __DIR__ . '/templates/footer.php';