<?php
/**
 * Public Layout File (No Authentication Required)
 * Kenyan Pension & Life Insurance Management System
 * 
 * This layout is for public pages like login, forgot password, etc.
 */

// =============================================================================
// 1. START SESSION (Before any output)
// =============================================================================
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

// =============================================================================
// 2. INCLUDE REQUIRED FILES (Before any output)
// =============================================================================
// Only include database connection, NOT auth.php
require_once __DIR__ . '/dbconn.php';

// =============================================================================
// 3. HELPER FUNCTIONS
// =============================================================================
function includeFileWithVariables($filePath, $variables = array(), $print = true)
{
    $output = NULL;
    if(file_exists($filePath)){
        // Extract the variables to a local namespace
        extract($variables);
        // Start output buffering
        ob_start();
        // Include the template file
        include $filePath;
        // End buffering and return its contents
        $output = ob_get_clean();
    }
    if ($print) {
        print $output;
    }
    return $output;
}

// NO AUTHENTICATION CHECKS HERE - This is for public pages
?>