<?php
// Version
define('VERSION', '3.0.3.8');
if (extension_loaded('xhprof') && isset($_GET['xhprof'])) {
    define('XHPROF_LIB_ROOT', '/var/www/oc39.site/xhprof_lib');
    include_once '/var/www/oc39.site/xhprof_lib/config.php';
    include_once '/var/www/oc39.site/xhprof_lib/utils/xhprof_lib.php';
    include_once '/var/www/oc39.site/xhprof_lib/utils/xhprof_runs.php';

    xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
}
// Configuration
if (is_file('config.php')) {
    if ($_SERVER['SERVER_NAME'] == 'dev2.oc39.site') {
        require_once('dev.config.php');
    } else {
        require_once('config.php');
    }

}

// Install
if (!defined('DIR_APPLICATION')) {
	header('Location: install/index.php');
	exit;
}

//if (file_exists($li = DIR_APPLICATION.'/controller/extension/lightning/gamma.php')) require_once($li); //Lightning

// Startup
require_once(DIR_SYSTEM . 'startup.php');

start('catalog');
if (extension_loaded('xhprof') && isset($_GET['xhprof'])) {
    $profilerNamespace = 'oc39';
    $xhprofData = xhprof_disable();
    $xhprofRuns = new XHProfRuns_Default();
    $runId = $xhprofRuns->save_run($xhprofData, $profilerNamespace);
}