<?php
if (defined('ENVIRONMENT')) {
    $is_https = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on');

    $http = ($is_https == true ? 'https://' : 'http://');
    switch (ENVIRONMENT) {
        case 'DEVELOPMENT':
            $server_url = $http . $_SERVER['HTTP_HOST'] . '/mysticalmermaidvillastjohn/';
            $server_database = '';
            $server_user_name = '';
            $server_password = '';
            $document_root = $_SERVER['DOCUMENT_ROOT'] . '/mysticalmermaidvillastjohn/';
            ini_set('display_errors', 1);
            ini_set('display_startup_errors', 1);
            error_reporting(E_ALL);
            break;
        case 'PRODUCTION':
            $server_url = $http . $_SERVER['SERVER_NAME'] . '/demo/mysticalmermaidvillastjohn/';
            $server_database = '';
            $server_user_name = '';
            $server_password = '';
            $document_root = $_SERVER['DOCUMENT_ROOT'] . '/demo/mysticalmermaidvillastjohn/';
            error_reporting(E_ALL);
            ini_set('display_errors', 0);
            ini_set('display_startup_errors', 0);
            break;
        default:
            exit('The application environment is not set correctly.');
    }
}
ini_set('log_errors', 1);   // Mechanism to log errors
defined('APP_ROOT') || define('APP_ROOT', dirname(__FILE__));
defined('ABSOLUTE_URL') || define('ABSOLUTE_URL', $document_root);
defined('UPLOAD_ROOT') || define('UPLOAD_ROOT', ABSOLUTE_URL . 'public/images/');
defined('SITE_URL') || define('SITE_URL', $server_url);
defined('ADMIN_URL') || define('ADMIN_URL', $server_url . 'admin/');
defined('HOST_NAME') || define('HOST_NAME', 'localhost');
defined('DATABASE') || define('DATABASE', $server_database);
defined('USER_NAME') || define('USER_NAME', $server_user_name);
defined('PASSWORD') || define('PASSWORD', $server_password);
defined('APP_DIR') || define('APP_DIR', '../app/');
// File maximum size, in mb
defined('FILE_MAX_SIZE') || define('FILE_MAX_SIZE', 4);
// Allowed extensions
defined('FILE_EXT') || define('FILE_EXT', array('jpg', 'jpeg', 'png',));
// Root for the upload directory
// Cookie expiry time in seconds
define("COOKIE_EXPIRY", 7 * 86400);
