Please insert the correct value in the file 'config/init.php' or leave it to 'generic'
"; } else { $result = "ERROR: The environment '{$env}' does not exist!
"; $help = "Please insert the correct value in the file 'config/init.php' or leave it to 'generic'
"; } echo $option === "result" ? $result : $help; } /** * Get current page safely. */ function get_current_page() { $page = $_GET["page"] ?? "home"; $page = strtolower(trim($page)); $page = preg_replace("/[^a-z0-9\-]/", "", $page); if ($page === "") { $page = "home"; } return $page; } /** * Resolve page file. */ function resolve_page() { $page = get_current_page(); $file = PAGES_FOLD . $page . ".php"; // 👉 rendi disponibile globalmente $GLOBALS["current_page"] = $page; if (file_exists($file)) { return $file; } http_response_code(404); $GLOBALS["current_page"] = "404"; return PAGES_FOLD . "404.php"; } /** * DEBUG FUNCTIONS AND ARRAY */ $debug_messages = [ 'High' => [], 'Medium' => [], 'Low' => [] ]; // FUNCTION TO GET DEBUG STATUS MESSAGES function debugStatusMes( string $Message, string $intensity) { global $debug, $debug_messages; // Controlla se il debug è attivo if ($debug !== "on") { return; } // Normalizza l'intensità per evitare errori di battitura (es. "high" diventa "High") $intensity = ucfirst(strtolower($intensity)); // Verifica che l'intensità sia valida prima di inserire il messaggio if (array_key_exists($intensity, $debug_messages)) { $debug_messages[$intensity][] = $Message; } else { // Se l'intensità non è corretta, la salva in una categoria generica o Low $debug_messages['Low'][] = "[Intensità errata: $intensity] " . $Message; } } // DISPLAY DEBUG ERROR BAR function displayDebug() { global $debug, $debug_messages; if ($debug !== "on") { return; } // Contenitore temporaneo nascosto per non creare sfarfallii nella pagina echo ''; // Questo script JS prende il contenuto appena generato e lo sposta nel segnaposto in cima ?>