<?php
// includes/site-data.php - Dynamic Site Settings Loader
// This file loads all settings from site_settings table

$S = []; // Short variable for easy use

try {
    $stmt = $pdo->query("SELECT setting_key, setting_value FROM site_settings");
    while($row = $stmt->fetch()) {
        $S[$row['setting_key']] = $row['setting_value'];
    }
} catch(PDOException $e) {
    // If table doesn't exist, use defaults
    $S = [];
}

// Set defaults if settings are empty
$S['site_title'] = $S['site_title'] ?? 'ONESBD LMS';
$S['logo_text'] = $S['logo_text'] ?? 'ONESBD LMS';
$S['logo_icon'] = $S['logo_icon'] ?? 'fa-graduation-cap';
$S['primary_color'] = $S['primary_color'] ?? '#6C5CE7';
$S['footer_text'] = $S['footer_text'] ?? 'ONESBD LMS | সর্বস্বত্ব সংরক্ষিত';
$S['use_image_logo'] = $S['use_image_logo'] ?? '0';
$S['logo_image'] = $S['logo_image'] ?? '';
$S['site_subtitle'] = $S['site_subtitle'] ?? 'অনলাইন লার্নিং প্ল্যাটফর্ম';
$S['phone1'] = $S['phone1'] ?? '';
$S['email1'] = $S['email1'] ?? '';
$S['facebook_url'] = $S['facebook_url'] ?? '#';
$S['youtube_url'] = $S['youtube_url'] ?? '#';
$S['linkedin_url'] = $S['linkedin_url'] ?? '#';
$S['instagram_url'] = $S['instagram_url'] ?? '#';
$S['whatsapp_number'] = $S['whatsapp_number'] ?? '';
$S['address_line1'] = $S['address_line1'] ?? '';
$S['address_line2'] = $S['address_line2'] ?? '';
$S['phone2'] = $S['phone2'] ?? '';
$S['email2'] = $S['email2'] ?? '';
$S['office_hours'] = $S['office_hours'] ?? '';
$S['map_embed_url'] = $S['map_embed_url'] ?? '';
$S['hero_title'] = $S['hero_title'] ?? 'আপনার ভবিষ্যৎ গড়ুন আমাদের সাথে';
$S['hero_subtitle'] = $S['hero_subtitle'] ?? 'হাজারো শিক্ষার্থীর সাথে যোগ দিন';
$S['about_title'] = $S['about_title'] ?? 'আমাদের সম্পর্কে';
$S['about_description'] = $S['about_description'] ?? 'বাংলা ভাষায় মানসম্মত শিক্ষা প্রদানে আমরা অঙ্গীকারবদ্ধ';
$S['stats_students'] = $S['stats_students'] ?? '0';
$S['stats_courses'] = $S['stats_courses'] ?? '0';
$S['stats_instructors'] = $S['stats_instructors'] ?? '0';
$S['stats_enrollments'] = $S['stats_enrollments'] ?? '0';
?>