<?php
define('SITE_NAME',   '20th Kenya Expo by Inexpo Group');
define('SITE_URL',    'https://kenya-expo.com');
define('SITE_EMAIL',  'salman@inexpo.ae');
define('NOTIFY_EMAILS', ['info@inexpos.com']); // Recipients for all form submissions (registration, contact, newsletter)
define('SITE_PHONE',  '+971 55 5506187');
define('EVENT_DATE',  'November 19–22, 2026');
define('EVENT_VENUE', 'Kenyatta International Convention Centre (KICC), Nairobi, Kenya');
define('ORG_NAME',    'Inexpo Group');
define('EVENT_EDITION', '20th Anniversary Edition');

define('ADMIN_EMAIL',         'marketing@infairsafrica.com');
define('ADMIN_PASSWORD_HASH', '$2y$10$6geGLBW9ae8mWI4X.yHhZ.sdlY.qILynCw6MCC.TvnlLL7OHctw0.');

define('LEADS_FILE',          __DIR__ . '/../data/leads.json');
define('GALLERY_FILE',        __DIR__ . '/../data/gallery_images.json');
define('PACKAGES_FILE',       __DIR__ . '/../data/packages.json');
define('SPONSORSHIP_FILE',    __DIR__ . '/../data/sponsorship.json');
define('IMAGES_FILE',         __DIR__ . '/../data/images.json');
define('KENYA_FACTS_FILE',    __DIR__ . '/../data/kenya_facts.json');
define('TRADE_INDUSTRY_FILE', __DIR__ . '/../data/trade_industry.json');
define('EXHIBITOR_CATS_FILE', __DIR__ . '/../data/exhibitor_categories.json');
define('EVENT_STATS_FILE',    __DIR__ . '/../data/event_stats.json');

if (session_status() === PHP_SESSION_NONE) { session_start(); }

function readJSON($path) {
    if (!file_exists($path)) return [];
    return json_decode(file_get_contents($path), true) ?? [];
}

function writeJSON($path, $data) {
    $fp = fopen($path, 'c+');
    if (flock($fp, LOCK_EX)) {
        ftruncate($fp, 0);
        fwrite($fp, json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
        flock($fp, LOCK_UN);
    }
    fclose($fp);
}

function generateCSRF() {
    if (empty($_SESSION['csrf_token']))
        $_SESSION['csrf_token'] = bin2hex(random_bytes(32));
    return $_SESSION['csrf_token'];
}

function validateCSRF($token) {
    return isset($_SESSION['csrf_token']) && hash_equals($_SESSION['csrf_token'], $token);
}
?>