| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/arni-solutions.de/web/terminal/ |
Upload File : |
<?php
/**
* Ansicht, geöffnet ÜBER ein Terminal: view.php?t=<view_token>&term=<terminal_hash>
* Dispatcht an das Modul der Ansicht (siehe includes/modules/registry.php).
* AJAX: &api=<action> (POST, CSRF) → JSON, vom Modul beantwortet.
*/
require_once __DIR__ . '/config.inc.php';
$db = term_db();
$token = (string)($_GET['t'] ?? '');
$term = (string)($_GET['term'] ?? '');
$isApi = isset($_GET['api']);
// Zugriff nur für GENAU DIESES Terminal (aktiv + gültiges Cookie + Ansicht zugeordnet).
// Bindet zugleich die Datenbasis an dieses Terminal (eigene Daten je Terminal).
$terminal = ($token !== '') ? term_terminal_grants_for($db, $token, $term) : null;
if (!$terminal) {
if ($isApi) term_json(['ok' => false, 'error' => 'forbidden'], 403);
http_response_code(403);
t_html('Kein Zugriff',
'<div class="t-gate"><div class="t-card t-gate-card">'
. '<div class="t-empty"><div class="ico">⛔</div>Kein Zugriff auf diese Ansicht.</div>'
. '<a class="t-btn t-btn-ghost" href="' . e('terminal.php?h=' . urlencode($term)) . '">Zurück zum Terminal</a>'
. '</div></div>', $term);
}
$st = $db->prepare('SELECT * FROM ' . term_tbl('views') . ' WHERE view_token = ? AND view_active = 1 LIMIT 1');
$st->execute([$token]);
$view = $st->fetch();
if (!$view) {
if ($isApi) term_json(['ok' => false, 'error' => 'not_found'], 404);
http_response_code(404);
t_html('Nicht verfügbar', '<div class="t-gate"><div class="t-card t-gate-card"><div class="t-empty"><div class="ico">🗂️</div>Ansicht nicht verfügbar.</div></div></div>', $term);
}
// ---- API (Modul-Aktion) ----
if ($isApi) {
if ($_SERVER['REQUEST_METHOD'] !== 'POST') term_json(['ok' => false, 'error' => 'method'], 405);
if (!term_csrf_ok($_POST['_csrf'] ?? null)) term_json(['ok' => false, 'error' => 'csrf'], 403);
term_module_api($db, $view, $terminal, (string)$_GET['api']);
exit; // Sicherheitsnetz – Module beenden selbst via term_json
}
// ---- Render (HTML) ----
t_html((string)$view['view_label'], term_module_render($db, $view, $terminal), $term);