<?php
/**
 * Project Configuration
 * Defines absolute paths to prevent directory creation outside project root
 */

// Define absolute project root directory
define('PROJECT_ROOT', __DIR__);

// Define absolute paths for data and image directories
define('DATA_DIR', PROJECT_ROOT . '/data');
define('IMG_DIR', PROJECT_ROOT . '/img');
define('PHP_DIR', PROJECT_ROOT . '/php');
define('JS_DIR', PROJECT_ROOT . '/js');

// Ensure data and img directories exist
if (!file_exists(DATA_DIR)) {
    mkdir(DATA_DIR, 0755, true);
}

if (!file_exists(IMG_DIR)) {
    mkdir(IMG_DIR, 0755, true);
}

if (!file_exists(IMG_DIR . '/chart-img')) {
    mkdir(IMG_DIR . '/chart-img', 0755, true);
}
?>
