/** * Central Legacy Router for Werbung Module * Routes clean URLs to legacy PHP files directly. */ require_once __DIR__ . '/../../db_session_li.php'; require_once __DIR__ . '/inc/bootstrap.php'; require_once __DIR__ . '/inc/helpers.php'; $file = $_GET['file'] ?? ''; if (empty($file)) { header('Location: /Werbung/'); exit; } $ext = pathinfo($file, PATHINFO_EXTENSION); $legacyFile = $file; if (empty($ext)) { $legacyFile .= '.php'; } // Special mappings if needed $mappings = [ 'Information' => 'Werbung_Information.php', ]; if (isset($mappings[$file])) { $legacyFile = $mappings[$file]; } $fullPath = __DIR__ . '/legacy/original/' . $legacyFile; if (!is_file($fullPath)) { http_response_code(404); echo "Legacy file not found: " . htmlspecialchars($legacyFile); exit; } // Legacy compatibility: many old scripts use $mysql instead of $con global $con, $mysql; $mysql = $con; // Determine how to include/read if (pathinfo($legacyFile, PATHINFO_EXTENSION) === 'js') { header('Content-Type: application/javascript; charset=UTF-8'); readfile($fullPath); } else { include $fullPath; }