<?php

/**
 * This file bassically boots up the application
 */
require_once dirname(__FILE__) . '/config.global.php';
define('DS', DIRECTORY_SEPARATOR);
//SApplication::$arrIncludes[''] = '';
define('__INC_DIR__', __DOCROOT__ . '/inc');
define('APP_DIR', __DOCROOT__ . '/apps');
define('CONTENT_DIR', __DOCROOT__ . '/content');
define('CONTENT_URL', __BASE_URL__ . '/content');
define('__PACKAGE_DIR__', CONTENT_DIR . '/packages');
define('__APP_TPL_DIR__', CONTENT_DIR . '/app_templates');
define('__UPLOADS_DIR__', CONTENT_DIR . '/uploads');
define('__UPLOADS_URL__', CONTENT_URL . '/uploads');
define('__PHP_ASSET_URL_BASE__', __BASE_URL__ . '/php_asset.php');
function __autoload($strClassName)
{
    if (!array_key_exists($strClassName, SApplication::$arrIncludes)) {
        throw new Exception('No class named "' . $strClassName . '" exists');
    }
    require_once SApplication::$arrIncludes[$strClassName];
}
require_once __INC_DIR__ . '/_enum.inc.php';
require_once __INC_DIR__ . '/_core/SApplication.class.php';
SApplication::LoadPackage('sdatalayer', '0.01');
//Data layer
SApplication::$arrIncludes['App'] = __INC_DIR__ . '/_core/data_layer/App.class.php';
SApplication::InitDB(DATABASE_1);
<?php

/* 
 * User defined configuration settings will go in here
 */
define('__CONTEST_DEBUG_MODE__', 'true');
//Comment this out before going live
//define('__ADMIN_FBUIDS__', '8601266,100001842107744');
//defined('__SHOW_UNLIKED_PAGE__', 'true');
//It is strongly recomended you set the template version
//define('APP_TEMPLATE_LOC', 'x.x');//only put the core in here
//here so the users can upgrade if they want
SApplication::LoadPackage('framework', '0.02');
SApplication::LoadPackage('contest', '0.02');
    define('__APP_TEMPLATE_CSS_ASSETS__', __APP_TEMPLATE_ASSETS__ . '/css');
    define('__APP_TEMPLATE_JS_ASSETS__', __APP_TEMPLATE_ASSETS__ . '/js');
    define('__APP_TEMPLATE_IMAGE_ASSETS__', __APP_TEMPLATE_ASSETS__ . '/images');
    //Normal
    define('__APP_ASSETS__', APP_FRONTEND_DIR . '/assets');
    define('__APP_PUB_ASSETS__', __APP_URL__ . '/assets');
    define('__APP_PHP_ASSETS__', __APP_ASSETS__ . '/php');
    define('__APP_TPL_ASSETS__', __APP_ASSETS__ . '/templates');
    define('__APP_CSS_ASSETS__', __APP_PUB_ASSETS__ . '/css');
    define('__APP_JS_ASSETS__', __APP_PUB_ASSETS__ . '/js');
    define('__APP_IMAGE_ASSETS__', __APP_PUB_ASSETS__ . '/images');
    if (!defined('FORM_VAR_ENC_KEY')) {
        define('FORM_VAR_ENC_KEY', md5('aeckiIE99381923'));
    }
    if (defined('APP_CONTROL_LOC')) {
        if (file_exists(APP_CONTROL_LOC)) {
            $strOldPrependLoc = sprintf('%s/_core/inc/php/prepend.inc.php', APP_BACKEND_DIR);
            if (file_exists($strOldPrependLoc)) {
                require_once $strOldPrependLoc;
            } else {
                require_once sprintf('%s/prepend.inc.php', APP_BACKEND_DIR);
            }
            require_once APP_CONTROL_LOC;
        } else {
            throw new Exception("Control file not found in Account App FTP Dir(" . APP_CONTROL_LOC . ")");
        }
    }
}
SApplication::AddRunFunction('FRAMEWK_RUN');
SApplication::LoadPackage('facebook', '0.01');