Example #1
0
/*
    steps:
    1. include platform config
    4. Detect core name and initialize by defining specific params
    5. based on loaded configs set casebox php options, session lifetime, error_reporting and define required casebox constants
*/
require_once 'config_platform.php';
$cfg = Cache::get('platformConfig');
//detect core and define core specific params
$cfg['core_name'] = detectCore() or die('Cannot detect core');
//set default database name
$cfg['db_name'] = PREFIX . $cfg['core_name'];
//loading core defined params
try {
    $cfg = array_merge($cfg, Config::getPlatformConfigForCore($cfg['core_name']));
} catch (\Exception $e) {
    //return http "not found" if cant load core config
    header(@$_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
    exit;
}
DB\connectWithParams($cfg);
//loading full config of the core
$config = Config::load($cfg);
//analize core status and display corresponding message if not active
$status = Config::getCoreStatus();
if ($status != Config::$CORESTATUS_ACTIVE) {
    echo Config::getCoreStatusMessage($status);
    exit;
}
//connect other database if specified in config for core