HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/panomity.de/vr.panomity.com/api/scenes.php
<?php
/**
 * Szenen-Katalog für den KI-Concierge (Auto-Tour, Navigation).
 * GET ?language=de → { scenes: [{id, name, description}] }
 */

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, OPTIONS');
header('Content-Type: application/json; charset=utf-8');

if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
    http_response_code(200);
    exit;
}

$language = strtolower(trim((string)($_GET['language'] ?? 'en')));
if (!preg_match('/^[a-z]{2}$/', $language)) {
    $language = 'en';
}

$db = new SQLite3(__DIR__ . '/../admin/data/vrm.db');
$db->busyTimeout(5000);

$stmt = $db->prepare("
    SELECT p.id,
           COALESCE(NULLIF(pp.name, ''), 'Scene ' || p.id) AS name,
           COALESCE(pp.description, '') AS description
    FROM panos p
    LEFT JOIN languages l ON l.short = :lang
    LEFT JOIN pano_phrases pp ON pp.panos_id = p.id AND pp.languages_id = l.id
    WHERE p.visible = 1 AND (p.type = 'pano' OR p.type = '' OR p.type IS NULL)
    ORDER BY p.position, p.id
");
$stmt->bindValue(':lang', $language, SQLITE3_TEXT);
$result = $stmt->execute();

$scenes = [];
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
    $scenes[] = [
        'id' => (int)$row['id'],
        'name' => (string)$row['name'],
        'description' => (string)$row['description'],
    ];
}
$db->close();

echo json_encode(['ok' => true, 'language' => $language, 'scenes' => $scenes], JSON_UNESCAPED_UNICODE);