Example #1
0
unset($config);
// Check if software is installed
if (Registry::get('config.db_host') == '%DB_HOST%') {
    die(PRODUCT_NAME . ' is <b>not installed</b>. Please click here to start the installation process: <a href="install/">[install]</a>');
}
// Connect to database
$db_conn = db_initiate(Registry::get('config.db_host'), Registry::get('config.db_user'), Registry::get('config.db_password'), Registry::get('config.db_name'));
//var_dump($db_conn);
if (!$db_conn) {
    fn_error(debug_backtrace(), 'Cannot connect to the database server', false);
}
// Clean up cache
if (isset($_GET['cc']) && (AREA == 'A' || defined('DEVELOPMENT'))) {
    fn_rm(DIR_COMPILED, false);
    fn_rm(DIR_CACHE, false);
    Registry::cleanup();
}
if (defined('MYSQL5')) {
    db_query("set @@sql_mode = ''");
}
register_shutdown_function(array('Registry', 'save'));
// define lifetime for the cache data
define('CACHE_LEVEL_TIME', 'time');
// First-level cache: static - the same for all requests
define('CACHE_LEVEL_STATIC', 'cache');
Registry::register_cache('settings', array('settings'), CACHE_LEVEL_STATIC);
// Get settings
if (Registry::is_exist('settings') == false) {
    Registry::set('settings', fn_get_settings());
}
// detect user agent